mmoreramerino/GearmanBundle — pull request #29 by alcaeus (2012-09-21 11:18:57+00:00)
Title: Fix issue with gearmand and persistent storage

I assume that this issue occurs mainly because of the PECL function not treating NULL values correctly.

In our case, when we created a background job with $container->get('gearman')->doBackgroundJob('name', 'payload') it only worked once. Creating a second job like this resulted in a gearman queue error. Debugging the issue further showed that this problem occured when using MySQL as persistent storage for gearmand. Leaving out the unique parameter to the \GearmanClient call fixes the issue, I assume that something goes wrong in between.
To fix this the unique parameter needs to be omitted when it's null. This will cause a new unique value to be generated for each job. Of course it's still possible to create the job with a specific unique value but it also works if it's omitted.