dylanahsmith/resque-lock — pull request #1 by boourns (2012-08-13 19:47:19+00:00)
Title: Lock scheduled jobs for entire time they're on queue

@dylanhsmith & @jduff Please review

This adds callbacks used by resque-scheduler to create a second lock which locks when the job is put onto the delayed schedule queue.

Before this change while a job was delayed it would not prevent duplicate jobs from also being delayed.

After this change you can have a delayed job lock against other delayed jobs being added.

It'd be better if it could be done safely with one lock, but then you'd have to release the lock for a brief moment while transferring the job from the scheduler queue to the resque queue and then relock in before_enqueue_lock opening a race condition for duplicate jobs.