module Resque::Plugins::SerialQueues
Constants
- VERSION
Public Class Methods
is_queue_locked?(queue)
click to toggle source
# File lib/resque/plugins/serial_queues.rb, line 20 def self.is_queue_locked?(queue) redis.exists("queue-lock:#{queue}") end
is_queue_serial?(queue)
click to toggle source
# File lib/resque/plugins/serial_queues.rb, line 16 def self.is_queue_serial?(queue) config.serial_queues.include?(queue.to_s) end
lock_queue(queue)
click to toggle source
# File lib/resque/plugins/serial_queues.rb, line 24 def self.lock_queue(queue) if redis.setnx("queue-lock:#{queue}", 1) redis.expire("queue-lock:#{queue}", config.lock_timeout) true else false end end
unlock_queue(queue)
click to toggle source
# File lib/resque/plugins/serial_queues.rb, line 33 def self.unlock_queue(queue) redis.del("queue-lock:#{queue}") end
Public Instance Methods
config()
click to toggle source
# File lib/resque/plugins/serial_queues.rb, line 4 def config @config ||= Config.new end
configure() { |config| ... }
click to toggle source
# File lib/resque/plugins/serial_queues.rb, line 8 def configure yield(config) if block_given? end
redis()
click to toggle source
# File lib/resque/plugins/serial_queues.rb, line 12 def redis @redis ||= Redis::Namespace.new(:serial_queues, redis: Resque.redis) end