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 end
def quiet def quiet
`kill -USR1 #{pid}` `kill -TSTP #{pid}`
end end
def stop def stop

View file

@ -46,7 +46,7 @@ Toxiproxy.populate([{
}]) }])
self_read, self_write = IO.pipe self_read, self_write = IO.pipe
%w(INT TERM USR1 USR2 TTIN).each do |sig| %w(INT TERM TSTP TTIN).each do |sig|
begin begin
trap sig do trap sig do
self_write.puts(sig) self_write.puts(sig)
@ -67,14 +67,9 @@ def handle_signal(launcher, sig)
when 'TERM' when 'TERM'
# Heroku sends TERM and then waits 10 seconds for process to exit. # Heroku sends TERM and then waits 10 seconds for process to exit.
raise Interrupt raise Interrupt
when 'USR1' when 'TSTP'
Sidekiq.logger.info "Received USR1, no longer accepting new work" Sidekiq.logger.info "Received TSTP, no longer accepting new work"
launcher.quiet launcher.quiet
when 'USR2'
if Sidekiq.options[:logfile]
Sidekiq.logger.info "Received USR2, reopening log file"
Sidekiq::Logging.reopen_logs
end
when 'TTIN' when 'TTIN'
Thread.list.each do |thread| Thread.list.each do |thread|
Sidekiq.logger.warn "Thread TID-#{thread.object_id.to_s(36)} #{thread['label']}" 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 # Older versions of Upstart might not support the reload command and need
# this commented out. # this commented out.
reload signal USR1 reload signal TSTP
# Upstart waits 5 seconds by default to kill the a process. Increase timeout to # Upstart waits 5 seconds by default to kill the a process. Increase timeout to
# give sidekiq process enough time to exit. # give sidekiq process enough time to exit.

View file

@ -12,12 +12,12 @@ if ENV["COVERAGE"]
end end
ENV['RACK_ENV'] = ENV['RAILS_ENV'] = 'test' ENV['RACK_ENV'] = ENV['RAILS_ENV'] = 'test'
trap 'USR1' do trap 'TSTP' do
threads = Thread.list threads = Thread.list
puts puts
puts "=" * 80 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| threads.each do |thr|
description = thr == Thread.main ? "Main thread" : thr.inspect description = thr == Thread.main ? "Main thread" : thr.inspect

View file

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