Module: Sidekiq::Pauzer

Defined in:
lib/sidekiq/pauzer.rb,
lib/sidekiq/pauzer/web.rb,
lib/sidekiq/pauzer/config.rb,
lib/sidekiq/pauzer/queues.rb,
lib/sidekiq/pauzer/version.rb,
lib/sidekiq/pauzer/repository.rb,
lib/sidekiq/pauzer/patches/queue.rb,
lib/sidekiq/pauzer/patches/web_action.rb,
lib/sidekiq/pauzer/patches/basic_fetch.rb,
lib/sidekiq/pauzer/patches/web_application.rb

Defined Under Namespace

Modules: Patches, Web Classes: Config, Queues, Repository

Constant Summary collapse

VERSION =
"5.2.0"

Class Method Summary collapse

Class Method Details

.configure {|config| ... } ⇒ Object

Yields ‘config` for a block.

Examples:

Sidekiq::Pauzer.configure do |config|
  config.refresh_rate = 42
end

Yield Parameters:



94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/sidekiq/pauzer.rb', line 94

def configure
  MUTEX.synchronize do
    config = @config.dup

    yield config

    @config = config.freeze

    self
  ensure
    reinit_queues
  end
end

.pause!(queue_name) ⇒ void

This method returns an undefined value.

Examples:

Sidekiq::Pauzer.pause!("minor")
Sidekiq::Pauzer.paused?("minor") # => true

Parameters:

  • queue_name (#to_s)


47
48
49
50
# File 'lib/sidekiq/pauzer.rb', line 47

def pause!(queue_name)
  @repository.add(queue_name)
  nil
end

.paused?(queue_name) ⇒ Boolean, void

Examples:

Sidekiq::Pauzer.pause!("minor")
Sidekiq::Pauzer.paused?("minor")  # => true
Sidekiq::Pauzer.paused?("threat") # => false

Returns:

  • (Boolean)
  • (void)


71
72
73
# File 'lib/sidekiq/pauzer.rb', line 71

def paused?(queue_name)
  @repository.include?(queue_name)
end

.paused_queuesArray<String>

Eventually consistent list of paused queues.

Examples:

Sidekiq::Pauzer.pause!("minor")
Sidekiq::Pauzer.paused_queues # => ["minor"]

Returns:

  • (Array<String>)


82
83
84
# File 'lib/sidekiq/pauzer.rb', line 82

def paused_queues
  @queues.to_a
end

.shutdownObject



114
115
116
117
118
# File 'lib/sidekiq/pauzer.rb', line 114

def shutdown
  MUTEX.synchronize { @queues.stop_refresher }

  self
end

.startupObject



108
109
110
111
112
# File 'lib/sidekiq/pauzer.rb', line 108

def startup
  MUTEX.synchronize { reinit_queues.start_refresher }

  self
end

.unpause!(queue_name) ⇒ void

This method returns an undefined value.

Examples:

Sidekiq::Pauzer.pause!("minor")
Sidekiq::Pauzer.paused?("minor") # => true
Sidekiq::Pauzer.unpause!("minor")
Sidekiq::Pauzer.paused?("minor") # => false

Parameters:

  • queue_name (#to_s)


60
61
62
63
# File 'lib/sidekiq/pauzer.rb', line 60

def unpause!(queue_name)
  @repository.delete(queue_name)
  nil
end