diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-11-23 09:52:48 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-11-23 10:36:39 +0000 |
commit | 90d1d769b9af83d6d1464658169e72b9467ab384 (patch) | |
tree | 9fdd30d4c9f03e5ad7b7fb8e9e8d22b0e081c6e6 /lib/zbatery.rb | |
parent | b6b36c534ae1b6f8120d3e48eca47463f21b06ea (diff) | |
download | zbatery-90d1d769b9af83d6d1464658169e72b9467ab384.tar.gz |
zbatery: unlink pid file during graceful shutdown
We don't have the same shutdown sequence as unicorn, there is no need to leave pid files hanging around during upgrades. Of course we can't guarantee this (or any) behavior for non-graceful shutdowns...
Diffstat (limited to 'lib/zbatery.rb')
-rw-r--r-- | lib/zbatery.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/zbatery.rb b/lib/zbatery.rb index 08ac5b1..735b1e6 100644 --- a/lib/zbatery.rb +++ b/lib/zbatery.rb @@ -75,6 +75,7 @@ module Rainbows end def join + at_exit { unlink_pid_safe(pid) if pid } trap(:INT) { exit!(0) } trap(:TERM) { exit!(0) } trap(:QUIT) { Thread.new { stop } } @@ -102,7 +103,7 @@ module Rainbows def stop(graceful = true) Rainbows.quit! - exit!(0) unless graceful + graceful ? exit : exit!(0) end def before_fork |