If you are getting queue entries "stuck" for a long time, it means your worker is not cleaning up or returning properly. The Queue itself does not do error logging, checking, etc. - all of that is handled by your worker function (since the queue really has no way to "know" what is to be done with a queue entry).
Your worker function should:
- return TRUE if it was successful. The queue entry will be deleted
- return FALSE if there was an error AND it wants the queue to be handed again to the next available worker
- return a positive integer to SLEEP the queue entry for the number of seconds returned - i.e. if your function returns "200" it means "hide this queue entry from all workers for 200 seconds.
Any LOGGING needs to be handled by your worker function - the core will not do logging for you.
Also - make sure when you are registering your worker function, you pass in the values as needed - i.e.
jrCore_register_queue_worker('jrAudio', 'audio_sample', 'jrAudio_create_audio_sample', 0, 4, 3600);
This says:
- When a new queue entry comes into the "audio_sample" queue, run the jrAudio_create_audio_sample() function.
- When the jrAudio_create_audio_sample() function RETURNS, give it another queue entry until there are no queue entries left for that queue (that's the first "0" - it means keep working til no queue entries left - if it was set to "5" the worker would do 5 jobs then exit).
- At most, left 4 jrAudio_create_audio_sample() functions be running
at the same time.
- If a worker has not returned after 3600 seconds, abort the job, kill the worker, and give the queue entry to a new worker.
So it is up to you and your developers to make sure your worker functions "play nice" with the Queue system.
Let me know if that helps.
--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
updated by @brian: 03/18/15 11:11:33AM