module Sidekiq::QueuePause

Constants

PREFIX

Attributes

process_key[W]
retry_after[RW]

Public Class Methods

pause(queue, pkey = nil) click to toggle source
# File lib/sidekiq-queue-pause.rb, line 20
def pause(queue, pkey = nil)
  Sidekiq.redis { |it| it.set rkey(queue, pkey), true }
end
paused?(queue, pkey = nil) click to toggle source
# File lib/sidekiq-queue-pause.rb, line 28
def paused?(queue, pkey = nil)
  Sidekiq.redis { |it| it.exists? rkey(queue, pkey) }
end
process_key(&block) click to toggle source
# File lib/sidekiq-queue-pause.rb, line 12
def process_key(&block)
  if block
    @process_key = block
  else
    @process_key.is_a?(Proc) ? @process_key.call : @process_key
  end
end
unpause(queue, pkey = nil) click to toggle source
# File lib/sidekiq-queue-pause.rb, line 24
def unpause(queue, pkey = nil)
  Sidekiq.redis { |it| it.del rkey(queue, pkey) }
end
unpause_all() click to toggle source
# File lib/sidekiq-queue-pause.rb, line 32
def unpause_all
  Sidekiq.redis { |it| it.keys("#{PREFIX}:*").each { |k| it.del k } }
end

Private Class Methods

rkey(queue, pkey) click to toggle source
# File lib/sidekiq-queue-pause.rb, line 38
def rkey(queue, pkey)
  pkey ? "#{PREFIX}:#{queue}:#{pkey}" : "#{PREFIX}:#{queue}"
end