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

Use new Thread#name API available in Ruby 2.3+

This commit is contained in:
Mike Perham 2019-08-02 09:54:52 -07:00
parent fda7cd2493
commit aacaa82430
2 changed files with 2 additions and 2 deletions

View file

@ -160,7 +160,7 @@ module Sidekiq
},
"TTIN" => ->(cli) {
Thread.list.each do |thread|
Sidekiq.logger.warn "Thread TID-#{(thread.object_id ^ ::Process.pid).to_s(36)} #{thread["sidekiq_label"]}"
Sidekiq.logger.warn "Thread TID-#{(thread.object_id ^ ::Process.pid).to_s(36)} #{thread.name}"
if thread.backtrace
Sidekiq.logger.warn thread.backtrace.join("\n")
else

View file

@ -22,7 +22,7 @@ module Sidekiq
def safe_thread(name, &block)
Thread.new do
Thread.current["sidekiq_label"] = name
Thread.current.name = name
watchdog(name, &block)
end
end