No commit activity in last 3 years
No release in over 3 years
A Resque plugin. If you want only one instance of your job queued or executing at a time, extend it with Resque::Jobs::QueueLock and/or Resque::Jobs::ExecutionLock.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Resque Fine-Grained Locks

A [Resque][rq] plugin. Requires Resque 1.7.0.

If you want only one instance of your job queued at a time, extend it with Resque::Plugins::QueueLock. You will be able to enqueue another job if one is currently executing.

For example:

require 'resque/plugins/queue_lock'

class UpdateNetworkGraph
  extend Resque::Plugins::QueueLock

  def self.perform(repo_id)
    heavy_lifting
  end
end

If you want only one instance of your job to execute at a time, extend it with Resque::Plugins::ExecutionLock. You can optionally use resque-retry if you want to retry locked jobs without them failing.

For example:

require 'resque/plugins/execution_lock'

class UpdateNetworkGraph extend Resque::Plugins::Retry extend Resque::Plugins::ExecutionLock

@retry_exceptions = [ Resque::Plugins::ExecutionLock::JobIsLocked ]

def self.perform(repo_id) heavy_lifting end end

And in your resque initializer (config/resque.rb):

require 'resque/failure/multiple'

Resque::Failure::MultipleWithRetrySuppression.classes = [Resque::Plugins::ExecutionLock::JobIsLocked] Resque::Failure.backend = Resque::Failure::MultipleWithRetrySuppression