Add job level locking in case multiple processes are trying to dequeue jobs.
dopry - January 10, 2008 - 06:18
| Project: | Job queue |
| Version: | 5.x-2.0 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | dopry |
| Status: | needs work |
Description
This patch depends on http://drupal.org/node/208286.
This patch adds a locked column to to the job_queue table and add a locked argument to job_queue_dequeue. When a job is dequeued the locked column will be set to the locked argument. You can use this to identify the called of job_queue_dequeue in the case you have multiple servers or processes handling the job queue.

#1
#2
here is an updated .test file to cover attempting to dequeue a locked job... It's hard to really test the feature, since you can't easily emulate concurrency within a test.
#3
The code has changed a bit in Drupal 6.
I would like to use this opportunity to add more information to the queue UI. The job status could be added to admin/reports/job_queue which says that the job is running, and for how long.