Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coexist with other signal handlers #4991

Merged
merged 3 commits into from Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changes.md
Expand Up @@ -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
---------
Expand Down
9 changes: 8 additions & 1 deletion lib/sidekiq/cli.rb
Expand Up @@ -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
Expand Down