Skip to content

Commit

Permalink
Merge pull request #32 from guss77/patch-1
Browse files Browse the repository at this point in the history
perform kill_all only after long running stop operation completes
  • Loading branch information
akzhan authored Jun 19, 2016
2 parents a67e0f4 + 029fc10 commit dd88193
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/bluepill/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def stop_process
logger.warning result.inspect
end
end

cleanup_process
elsif stop_signals
# issue stop signals with configurable delay between each
logger.warning "Sending stop signals to #{actual_pid}"
Expand All @@ -355,13 +355,13 @@ def stop_process
logger.info "Sending signal #{signal} to #{process.actual_pid}"
process.signal_process(signal)
end
cleanup_process
end
else
logger.warning "Executing default stop command. Sending TERM signal to #{actual_pid}"
signal_process('TERM')
cleanup_process
end
ProcessJournal.kill_all_from_journal(name) # finish cleanup
unlink_pid # TODO: we only write the pid file if we daemonize, should we only unlink it if we daemonize?

skip_ticks_for(stop_grace_time)
end
Expand Down Expand Up @@ -389,6 +389,11 @@ def restart_process
end
end

def cleanup_process
ProcessJournal.kill_all_from_journal(name) # finish cleanup
unlink_pid # TODO: we only write the pid file if we daemonize, should we only unlink it if we daemonize?
end

def clean_threads
@threads.each(&:kill)
@threads.clear
Expand Down

0 comments on commit dd88193

Please sign in to comment.