-
Notifications
You must be signed in to change notification settings - Fork 104
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
terminator handler #251
terminator handler #251
Conversation
@fabianfett this is still wip but wanted to get an initial feedback on the direction / approach before investing more serious time into this |
720911b
to
dee3570
Compare
dee3570
to
0819fa3
Compare
motivation: make it simpler to register shutdown hooks changes: * introduce Terminator helper that allow registering and de-registaring shutdown handlers * expose the new terminator hanler on the InitializationContext and deprecate ShutdownContext * deprecate the Handler::shutdown protocol requirment * update the runtime code to use the new terminator instead of calling shutdown on the handler * add and adjust tests
0819fa3
to
8f1c4ff
Compare
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.
Overall looks reasonable. Got one question about the tests.
Co-authored-by: Yim Lee <yim_lee@apple.com>
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.
This is much better, than the ShutdownHandler method. Couple of questions/nits.
extension Lambda { | ||
/// Lambda terminator. | ||
/// Utility to manage the lambda shutdown sequence. | ||
public final class Terminator { |
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.
I think the Terminator should be Sendable
for 5.6 and onwards.
private var index: [String] | ||
private var map: [String: (name: String, handler: Terminator.Handler)] | ||
|
||
public init() { |
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.
public init() { | |
init() { |
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.
Was this missed?
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.
Two small nits, left, that shouldn't stop us from merging.
private var index: [String] | ||
private var map: [String: (name: String, handler: Terminator.Handler)] | ||
|
||
public init() { |
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.
Was this missed?
motivation: make it simpler to register shutdown hooks
changes: