Class: Sidekiq::Simulator

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/sidekiq/simulator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(queue) ⇒ Simulator

Returns a new instance of Simulator.


17
18
19
20
# File 'lib/sidekiq/simulator.rb', line 17

def initialize(queue)
  @queues = [queue].flatten.uniq
  @launcher = Sidekiq::Launcher.new(sidekiq_options(queues))
end

Instance Attribute Details

#launcherObject (readonly)

Returns the value of attribute launcher


11
12
13
# File 'lib/sidekiq/simulator.rb', line 11

def launcher
  @launcher
end

#queuesObject (readonly)

Returns the value of attribute queues


11
12
13
# File 'lib/sidekiq/simulator.rb', line 11

def queues
  @queues
end

Class Method Details

.process_queue(queue) ⇒ Object


13
14
15
# File 'lib/sidekiq/simulator.rb', line 13

def self.process_queue(queue)
  new(queue).process_queue { yield }
end

Instance Method Details

#process_queueObject


22
23
24
25
26
# File 'lib/sidekiq/simulator.rb', line 22

def process_queue
  run_launcher { yield }
ensure
  terminate_launcher
end