Download & Extend

Add job level locking in case multiple processes are trying to dequeue jobs.

Project:Job queue
Version:5.x-2.0
Component:Code
Category:feature request
Priority:normal
Assigned:dopry
Status:needs work

Issue Summary

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.

Comments

#1

AttachmentSize
job_queue-locking.patch 2.15 KB

#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.

AttachmentSize
jobqueue.test 2.71 KB

#3

Status:needs review» needs work

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.