Class: Shoryuken::Launcher

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/shoryuken/launcher.rb

Instance Method Summary collapse

Methods included from Util

#elapsed, #fire_event, #logger, #unparse_queues, #worker_name

Constructor Details

#initializeLauncher

Returns a new instance of Launcher.



5
6
7
# File 'lib/shoryuken/launcher.rb', line 5

def initialize
  @managers = create_managers
end

Instance Method Details

#healthy?Boolean

Returns:

  • (Boolean)


42
43
44
45
46
47
# File 'lib/shoryuken/launcher.rb', line 42

def healthy?
  Shoryuken.groups.keys.all? do |group|
    manager = @managers.find { |m| m.group == group }
    manager && manager.running?
  end
end

#startObject



9
10
11
12
13
14
# File 'lib/shoryuken/launcher.rb', line 9

def start
  logger.info { 'Starting' }

  start_callback
  start_managers
end

#stopObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/shoryuken/launcher.rb', line 28

def stop
  fire_event(:quiet, true)

  initiate_stop

  stop_new_dispatching
  await_dispatching_in_progress

  executor.shutdown
  executor.wait_for_termination

  fire_event(:stopped)
end

#stop!Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/shoryuken/launcher.rb', line 16

def stop!
  initiate_stop

  # Don't await here so the timeout below is not delayed
  stop_new_dispatching

  executor.shutdown
  executor.kill unless executor.wait_for_termination(Shoryuken.options[:timeout])

  fire_event(:stopped)
end