-
Notifications
You must be signed in to change notification settings - Fork 41
Support adding services while ServiceGroup
is running
#199
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
Support adding services while ServiceGroup
is running
#199
Conversation
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 a great start. Thanks for working on this. I left some feedback inline.
ok, merging the but the async algorithms package only has a sendable-required how off am I? any better ideas? |
Yeah I expected you run into this. So the problem is that This way we only have to transfer the iterator of the channel in and out of child tasks which requires some unchecked sendable but is totally safe. Does that make sense? |
^^ I was just coding this exact thing, but I wasn't sure if it is too crazy ; ) |
@FranzBusch I managed to clean up the channel reading, I think that part is good enough now. The remaining question is what to do with added services during shutdown or cancel? If we want a reliable back-propagation of "has it run or not?" we'll need to pass along a continuation I think and we'd need to make sure to fully drain and actively "reject" all added service until we set the status to A lot of brittle and racy signaling... if we simply ignored (like now) life would be a lot easier ; ) |
thanks @FranzBusch for the quick reviews! I addressed the feedback from above, but I am still a bit scared of the "best effort" nature of it. So, as a suggestion, I renamed the function to This would also allow us to one day add a wdyt? |
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 looks great. I'm happy with the new name and the implementation looks good to me. Just one last nit around the comment
@sliemeobn can you fix the license header check please |
@FranzBusch oops, done (is there an easy way to run the soundness checks locally?) |
Yeah you can use |
/// | ||
/// If the group is currently running, the added service will be started immediately. | ||
/// If the group is gracefully shutting down, cancelling, or already finished, the added service will not be started. | ||
/// - Parameters: |
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.
Apologies for the late review - it'd be great to call out that this can also be used for adding services before the group was started. Right now the comment leaves that ambiguous of what happens.
somewhat straight-forward implementation draft of
#185
choices were made, what do we think?