fivebeans icon indicating copy to clipboard operation
fivebeans copied to clipboard

Multiple worker

Open DarkSorrow opened this issue 10 years ago • 3 comments

Hello,

I'm running two workers on the same tube with different ID tho using the fiverunner, but it seems that sometime both worker are trying to process the same job. From what i understood this shouldn't be possible because once a worker reserve the job the other isn't suppose to get the job as well no?

And i tested with different jobs being put on the tube and it seems to be a bit random the fact that both worker are trying to process the same job.

DarkSorrow avatar Jun 22 '15 09:06 DarkSorrow

Are you using the reserve function when picking up a job?

danielnielsen avatar Jun 22 '15 10:06 danielnielsen

I just started two runner with different client_id and when i tried to write the event "job.reserved" it both were reserving the same id job at about the same time. So i suppose that the runner itself do make a reserver before calling right?

Thats what i use in two different files, its really basic:

var runner = new FiveBeans.runner('SpoolerWorkerDefault', 'spooler_worker.yml'); runner.go();

var runner = new FiveBeans.runner('SpoolerWorkerSecond', 'spooler_worker.yml'); runner.go();

DarkSorrow avatar Jun 22 '15 14:06 DarkSorrow

Hello,

I am also facing this issue. Its because of the TTL of the job.

We should keep 'touch'ing the job in the handler's work function until the job is completed. Otherwise after reserving the job, it will be released back into the queue by beanstalkd server, if the job is not completed in the specified TTL in the put command.

Once its released, it will be reserved by the second worker.

sirhanshafahath avatar May 25 '16 13:05 sirhanshafahath