diff --git a/Changes.md b/Changes.md index 3aa6dbc2f..e5b66acea 100644 --- a/Changes.md +++ b/Changes.md @@ -22,6 +22,8 @@ require "sidekiq/middleware/current_attributes" Sidekiq::CurrentAttributes.persist(Myapp::Current) # Your AS:CurrentAttributes singleton ``` - Retry Redis operation if we get an `UNBLOCKED` Redis error. [#4985] +- **BREAKING CHANGE** Run existing signal-handling code, if there is any, before running sidekiq's + signal-handling code. [#4991] 6.2.2 --------- diff --git a/lib/sidekiq/cli.rb b/lib/sidekiq/cli.rb index df6339a67..8398759df 100644 --- a/lib/sidekiq/cli.rb +++ b/lib/sidekiq/cli.rb @@ -46,7 +46,14 @@ def run(boot_app: true) # USR1 and USR2 don't work on the JVM sigs << "USR2" if Sidekiq.pro? && !jruby? sigs.each do |sig| - trap sig do + old_handler = Signal.trap(sig) do + if old_handler.respond_to?(:call) + begin + old_handler.call + rescue Exception + puts $!.inspect + end + end self_write.puts(sig) end rescue ArgumentError