Skip to content

How to determine if jobs are running and debug job implementation code? #462

Answered by lovgrandma
lovgrandma asked this question in Q&A
Discussion options

You must be logged in to vote

I have since ran the worker functionality to create the server in a separate file with the code below and simply ran it as a go routine from the main() function from the main server application file. Seems to work.

srv := asynq.NewServer(
		asynq.RedisClientOpt{Addr: jobQueueAddr},
		asynq.Config{
			Concurrency: 10, // total concurrent workers
			Queues: map[string]int{
				"critical": 6,
				"default":  3,
				"low":      1,
			},
		},
	)
	mux := asynq.NewServeMux()
	mux.HandleFunc(sms_queue.TypeSmsDelivery, sms_queue.HandleSmsDeliveryTask)
	if err := srv.Run(mux); err != nil {
		log.Printf("Could not run Job Queue Server: %v", err)
	}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lovgrandma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant