Class: Shoryuken::Launcher
- Inherits:
-
Object
- Object
- Shoryuken::Launcher
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
7
8
9
10
|
# File 'lib/shoryuken/launcher.rb', line 7
def initialize
@managers = create_managers
@stopping = false
end
|
Instance Method Details
#healthy? ⇒ Boolean
58
59
60
61
62
63
|
# File 'lib/shoryuken/launcher.rb', line 58
def healthy?
Shoryuken.groups.keys.all? do |group|
manager = @managers.find { |m| m.group == group }
manager && manager.running?
end
end
|
#start ⇒ Object
23
24
25
26
27
28
|
# File 'lib/shoryuken/launcher.rb', line 23
def start
logger.info { 'Starting' }
start_callback
start_managers
end
|
#stop ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/shoryuken/launcher.rb', line 43
def stop
@stopping = true
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
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/shoryuken/launcher.rb', line 30
def stop!
@stopping = true
initiate_stop
stop_new_dispatching
executor.shutdown
executor.kill unless executor.wait_for_termination(Shoryuken.options[:timeout])
fire_event(:stopped)
end
|
#stopping? ⇒ Boolean
Indicates whether the launcher is in the process of stopping.
This flag is set to true when either #stop or #stop! is called, and is used by ActiveJob adapters to signal jobs that they should checkpoint and prepare for graceful shutdown.
19
20
21
|
# File 'lib/shoryuken/launcher.rb', line 19
def stopping?
@stopping
end
|