asynq icon indicating copy to clipboard operation
asynq copied to clipboard

[Question] Can worker avoid pick tasks for which does not have handler?

Open lealoureiro opened this issue 1 year ago • 6 comments

Hello,

I would like to check if it is expected behavior or if there is a way to change it.

I noticed if I connect a worker/consumer to the default queue that does not have implemented a handler for a certain pattern/task type, it still tries to consume the task and then puts back in queue incrementing the retry count and eventually exhaust all the retries.

Is expected that all workers connected to asynq on certain Redis instance, should be able to handle all types of tasks?

There might be some cases where some workers might interested in some kind of tasks and other in different ones. What should be the pattern to implement such use case? Different Redis instance? Different DB? Different queue names?

lealoureiro avatar Dec 13 '24 22:12 lealoureiro

Could you try using ServerMux and see if the retry count is decremented.

kamikazechaser avatar Dec 17 '24 05:12 kamikazechaser

I believe I'm already using the ServerMux:(https://gitlab.com/lealoureiro/jax-eda-go/-/blob/main/webhookworker/webhookworker.go?ref_type=heads Line 99.

The error: https://ibb.co/J5RzTLL

Because of the way that Redis works, asynq always needs to pick the task/object from redis and then put back correct?

lealoureiro avatar Dec 17 '24 21:12 lealoureiro

Before I run that code to investigate further, could you debug with the inspector/CLI? This kind of issue usually comes about because of incorrect use of the library (based on the previous issues reporting something similar).

Post the results of queue info and servers.

kamikazechaser avatar Dec 18 '24 12:12 kamikazechaser

Same issue: Archive queue error message

Please let me know if you need more info

lealoureiro avatar Dec 18 '24 22:12 lealoureiro

Same issue: Archive queue error message

Please let me know if you need more info

did you find the solution?

newarifrh avatar Mar 29 '25 04:03 newarifrh

I catch this issue in case of running two asynq server instances with the same settings, but different handlers. And didn't know how to resolve this situation.

Otetz avatar Apr 13 '25 01:04 Otetz