Class: UnicornRelay::Teardown
- Inherits:
-
Object
- Object
- UnicornRelay::Teardown
- Defined in:
- lib/unicorn_relay/teardown.rb
Overview
Before forking anew, kill the unicorn master process that belongs to the .oldbin PID. This enables 0 downtime deploys.
Instance Method Summary collapse
-
#initialize(server:, pid_file:) ⇒ Teardown
constructor
A new instance of Teardown.
-
#perform ⇒ Object
Peforms the teardown of the old unicorn master from one of the workers forked by the new master, if the new master has a different pid file.
Constructor Details
#initialize(server:, pid_file:) ⇒ Teardown
Returns a new instance of Teardown.
6 7 8 9 |
# File 'lib/unicorn_relay/teardown.rb', line 6 def initialize(server:, pid_file:) @server = server @pid_file = pid_file end |
Instance Method Details
#perform ⇒ Object
Peforms the teardown of the old unicorn master from one of the workers forked by the new master, if the new master has a different pid file.
13 14 15 |
# File 'lib/unicorn_relay/teardown.rb', line 13 def perform server_has_new_pid_file? && pid and kill_pid end |