antirez / disque

Disque is a distributed message broker
BSD 3-Clause "New" or "Revised" License
8.01k stars 538 forks source link

Reset the RETRY timer when a job is sent to a worker? #173

Open benbro opened 8 years ago

benbro commented 8 years ago

I have one disque server with two workers, all on the same machine. I'm adding a job with RETRY of 12 hours and TTL of 72 hours: ADDJOB queue_name job 1000 RETRY 3600_12 TTL 3600_72 Each job requires about 4 hours of processing before it ACKed.

Sometimes while worker-1 is processing a job, worker-2 is receiving the same job. I think it happens if worker-1 received the job after more than 8 hours so the RETRY timeout fires before it finished processing. I would expect the RETRY timer to reset when a worker received the job and only fire 12 hours after it.

I can use WORKING jobid if my above understanding is wrong.

skyrocknroll commented 8 years ago

@benbro Thank you. Now i am able to understand why the jobs are delivered more than once in my app. I assumed that RETRY will start the countdown only after the job is delivered to the worker.

abhidrona commented 8 years ago

@antirez If the timer is not reset then there will be a race between the time delivered and worker sending working to reset the retry time.