Class: Sidekiq::Launcher

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/launcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Launcher

Returns a new instance of Launcher.



8
9
10
11
12
# File 'lib/sidekiq/launcher.rb', line 8

def initialize(options)
  @options = options
  @manager = Sidekiq::Manager.new(options)
  @poller  = Sidekiq::Scheduled::Poller.new
end

Instance Attribute Details

#managerObject (readonly)

Returns the value of attribute manager.



7
8
9
# File 'lib/sidekiq/launcher.rb', line 7

def manager
  @manager
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/sidekiq/launcher.rb', line 7

def options
  @options
end

#pollerObject (readonly)

Returns the value of attribute poller.



7
8
9
# File 'lib/sidekiq/launcher.rb', line 7

def poller
  @poller
end

Instance Method Details

#procline(tag) ⇒ Object



25
26
27
28
# File 'lib/sidekiq/launcher.rb', line 25

def procline(tag)
  $0 = manager.procline(tag)
  manager.after(5) { procline(tag) }
end

#runObject



14
15
16
17
# File 'lib/sidekiq/launcher.rb', line 14

def run
  manager.async.start
  poller.async.poll(true)
end

#stopObject



19
20
21
22
23
# File 'lib/sidekiq/launcher.rb', line 19

def stop
  poller.async.terminate if poller.alive?
  manager.async.stop(:shutdown => true, :timeout => options[:timeout])
  manager.wait(:shutdown)
end