juriansluiman/SlmQueueDoctrine — pull request #43 by basz (2013-11-01 15:20:27+00:00)
Title: Job execution via cron

Hi,

I would like to re-add support for running job's via cron. (a project on a host on which I cannot use supervisor)

We lost this ability to do this safely when workers continued to run when no jobs were available.

Since cronjob is pretty -zombie- it would continue to spawn new workers until resources run out. And although the workers can be instructed to stop after 1 processed job this does not solve this issue (image no job for a long period of time).

I am looking for some ideas on how to do this most efficiently;

I'm thinking of a lock file. When a queue begins processing it will register itself in the tmp dir with a lock file. If a lock file is present it would just exit.
The lock file should contain an increment so more than one queue could be running by configuration. This incremental value must be (doctrine-)queue-name specific so maximums could be set for various queues.

I'm guessing this would work with the EVENT_PROCESS_QUEUE_PRE and EVENT_PROCESS_QUEUE_POST events

thoughts? ps. not on zftalk anymore?