1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Remove more USR1 references

This commit is contained in:
Mike Perham 2017-01-03 15:41:48 -08:00
parent 6a8e1e0702
commit 2363cef312
5 changed files with 8 additions and 13 deletions

View file

@ -64,7 +64,7 @@ class Sidekiqctl
end
def quiet
`kill -USR1 #{pid}`
`kill -TSTP #{pid}`
end
def stop

View file

@ -46,7 +46,7 @@ Toxiproxy.populate([{
}])
self_read, self_write = IO.pipe
%w(INT TERM USR1 USR2 TTIN).each do |sig|
%w(INT TERM TSTP TTIN).each do |sig|
begin
trap sig do
self_write.puts(sig)
@ -67,14 +67,9 @@ def handle_signal(launcher, sig)
when 'TERM'
# Heroku sends TERM and then waits 10 seconds for process to exit.
raise Interrupt
when 'USR1'
Sidekiq.logger.info "Received USR1, no longer accepting new work"
when 'TSTP'
Sidekiq.logger.info "Received TSTP, no longer accepting new work"
launcher.quiet
when 'USR2'
if Sidekiq.options[:logfile]
Sidekiq.logger.info "Received USR2, reopening log file"
Sidekiq::Logging.reopen_logs
end
when 'TTIN'
Thread.list.each do |thread|
Sidekiq.logger.warn "Thread TID-#{thread.object_id.to_s(36)} #{thread['label']}"

View file

@ -40,7 +40,7 @@ normal exit 0 TERM
# Older versions of Upstart might not support the reload command and need
# this commented out.
reload signal USR1
reload signal TSTP
# Upstart waits 5 seconds by default to kill the a process. Increase timeout to
# give sidekiq process enough time to exit.

View file

@ -12,12 +12,12 @@ if ENV["COVERAGE"]
end
ENV['RACK_ENV'] = ENV['RAILS_ENV'] = 'test'
trap 'USR1' do
trap 'TSTP' do
threads = Thread.list
puts
puts "=" * 80
puts "Received USR1 signal; printing all #{threads.count} thread backtraces."
puts "Received TSTP signal; printing all #{threads.count} thread backtraces."
threads.each do |thr|
description = thr == Thread.main ? "Main thread" : thr.inspect

View file

@ -335,7 +335,7 @@ class TestCli < Sidekiq::Test
end
end
describe 'handles USR1 and USR2' do
describe 'handles TSTP and USR2' do
before do
@tmp_log_path = '/tmp/sidekiq.log'
@cli.parse(['sidekiq', '-L', @tmp_log_path, '-r', './test/fake_env.rb'])