Class: Sidekiq::Pauzer::Repository

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/sidekiq/pauzer/repository.rb

Constant Summary collapse

REDIS_KEY =
"sidekiq-pauzer"

Instance Method Summary collapse

Instance Method Details

#add(queue_name) ⇒ void

This method returns an undefined value.

Parameters:

  • queue_name (#to_s)


27
28
29
30
# File 'lib/sidekiq/pauzer/repository.rb', line 27

def add(queue_name)
  redis_call("SADD", REDIS_KEY, queue_name.to_s)
  nil
end

#delete(queue_name) ⇒ void

This method returns an undefined value.

Parameters:

  • queue_name (#to_s)


34
35
36
37
# File 'lib/sidekiq/pauzer/repository.rb', line 34

def delete(queue_name)
  redis_call("SREM", REDIS_KEY, queue_name.to_s)
  nil
end

#eachEnumerator<String> #each {|queue_name| ... } ⇒ self

Overloads:

  • #eachEnumerator<String>

    Returns:

    • (Enumerator<String>)
  • #each {|queue_name| ... } ⇒ self

    For a block { |queue_name| … }

    Yield Parameters:

    • queue_name (String)

    Returns:

    • (self)


17
18
19
20
21
22
23
# File 'lib/sidekiq/pauzer/repository.rb', line 17

def each
  return to_enum __method__ unless block_given?

  redis_call("SMEMBERS", REDIS_KEY).each { yield _1.freeze }

  self
end

#include?(queue_name) ⇒ void

This method returns an undefined value.

Parameters:

  • name (#to_s)


41
42
43
# File 'lib/sidekiq/pauzer/repository.rb', line 41

def include?(queue_name)
  redis_call("SISMEMBER", REDIS_KEY, queue_name.to_s).positive?
end