-
-
Notifications
You must be signed in to change notification settings - Fork 8
SIGTERM is now graceful, the same as SIGINT.
#50
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
Conversation
f9f1055 to
d7adc72
Compare
57f83c2 to
9f6133b
Compare
af20806 to
15d0b97
Compare
a91391b to
93cec86
Compare
| # $stderr.puts "Received TERM signal, terminating...", caller | ||
| ::Thread.current.raise(Terminate) | ||
| # $stderr.puts "Received TERM signal, interrupting...", caller | ||
| ::Thread.current.raise(Interrupt) # Same as SIGINT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not change the rescue Terminate block instead of changing the raised exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be possible, but Async itself specifically handles Interrupt differently from Terminate.
Interrupt triggers a graceful stop of the Async scheduler: https://github.com/socketry/async/blob/400bc2e1fedcaa72ae1fa86d5c8d7e1962c1f889/lib/async/scheduler.rb#L534-L543
I think we want to preserve this behaviour, and if we raised Terminate it would cause an ungraceful exit.
Later on, I think we can revisit this if necessary.
Fixes #49.
Types of Changes
Contribution