I have beanstalkd setup. I'm using the pheanstalk php library for adding jobs and for my workers.
Adding jobs is working correctly and I am logging the job id's in my database for later reference. No job id's are being skipped IE: they go in there sequentially numbered: 1,2,3,4
Now the part thats sort of working is the workers. They are working in the fact that they do what there supposed to but I have three of them running and for some reason the same job gets run two or three times rather than just once.
I'm not sure why this would be happening I am simply using a while loop with a memory check + my job code to monitor for a new job.
Here is the start of that code.
while (1) {
$job = $this->pheanstalk->watch('my_tube')->ignore('default')->reserve();
$job_decoded = json_decode($job->getData(), false);
Here is the output from benstalk console. Ignore the first line as that is the default tube which I am not using.
After adding one more job to the queue the total column incresses to 4 and nothing else changes.
I found out the issue was an error causing the first worker to do what it was supposed to do but then crashing before removing the job.
So the next worker would pick it up and it would fail jumping to my catch block and bypassing the php error and then delete the job.