dereuromark / cakephp-queue

Queue plugin for CakePHP - simple, pure PHP and without dependencies.
MIT License
306 stars 137 forks source link

add random number to workerkey generation #347

Closed LordSimal closed 2 years ago

LordSimal commented 2 years ago

Sometimes we get random SQL errors like this one when running the queue worker:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '35a454c17942a60acb27fb20fccb3cce8e1b70b0' for key 'workerkey'

seems like under certain (unknown) circumstances the generated workerkey name is not unique because microtime() seems to return the same value for different workers.

This fix should at least reduce the chance of generating exactly the same workerkey.