Skip to content
Browse files

Use WorkerPool.workers rather than touching the children hash directly

  • Loading branch information...
1 parent ef647a5 commit fff2997eb48d01381ff844f22c1c45c4cd4a72ad @gdb gdb committed
Showing with 6 additions and 6 deletions.
  1. +5 −5 lib/einhorn/command/interface.rb
  2. +1 −1 lib/einhorn/worker_pool.rb
View
10 lib/einhorn/command/interface.rb
@@ -148,17 +148,17 @@ def self.default_pidfile(cmd_name=nil)
## Signals
def self.install_handlers
Signal.trap("INT") do
- Einhorn::Command.signal_all("USR2", Einhorn::State.children.keys)
+ Einhorn::Command.signal_all("USR2", Einhorn::WorkerPool.workers)
Einhorn::State.respawn = false
end
Signal.trap("TERM") do
- Einhorn::Command.signal_all("TERM", Einhorn::State.children.keys)
+ Einhorn::Command.signal_all("TERM", Einhorn::WorkerPool.workers)
Einhorn::State.respawn = false
end
# Note that quit is a bit different, in that it will actually
# make Einhorn quit without waiting for children to exit.
Signal.trap("QUIT") do
- Einhorn::Command.signal_all("QUIT", Einhorn::State.children.keys)
+ Einhorn::Command.signal_all("QUIT", Einhorn::WorkerPool.workers)
Einhorn::State.respawn = false
exit(1)
end
@@ -166,12 +166,12 @@ def self.install_handlers
Signal.trap("ALRM") {Einhorn::Command.full_upgrade}
Signal.trap("CHLD") {Einhorn::Event.break_loop}
Signal.trap("USR2") do
- Einhorn::Command.signal_all("USR2", Einhorn::State.children.keys)
+ Einhorn::Command.signal_all("USR2", Einhorn::WorkerPool.workers)
Einhorn::State.respawn = false
end
at_exit do
if Einhorn::State.kill_children_on_exit && Einhorn::TransientState.whatami == :master
- Einhorn::Command.signal_all("USR2", Einhorn::State.children.keys)
+ Einhorn::Command.signal_all("USR2", Einhorn::WorkerPool.workers)
Einhorn::State.respawn = false
end
end
View
2 lib/einhorn/worker_pool.rb
@@ -1,7 +1,7 @@
module Einhorn
module WorkerPool
def self.workers
- Einhorn::State.children.map {|pid, _| pid}
+ Einhorn::State.children.keys
end
def self.unsignaled_workers

0 comments on commit fff2997

Please sign in to comment.
Something went wrong with that request. Please try again.