-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract Client subscriptions into service (#379)
* extract Client subscriptions into service This change extracts the Client subscriptions logic into a separate `startstop.Service` which can be started and stopped along with the other services. The important change that enables this is switching from a _callback_ for job events to a _channel_ for job events. The channel is passed to the completer during init, and the completer then owns it as the sole sender. When the completer is stopped, it must close the channel to indicate that there are no more job completion events to be processed. This moves us closer to having all the key client services be able to be managed as a single pool of services, and they can all have their shutdown initiated in parallel. Importantly, this paves the way for additional services to be added (even by external libraries) without needing to deal with more complex startup & shutdown ordering scenarios. In order to make this work with a client that can be started and stopped repeatedly, a new `ResetSubscribeChan` method was added to the `JobCompleter` interface to be called at the beginning of each `Client.Start()` call. * normalize subscription manager service Respect a stop, but in the case of one, makes sure to clear the subscription channel before leaving, which means that it still correctly clears all events on a client shutdown. This gives us a way to use the stress test because all we need to do is close the channel in advance before calling startstoptest.Stress (the service is still a little weird compared to other because it requires that channel close, but a little less so). Also normalizes things a bit by removing the custom Stop implementation, which most services shouldn't need. Co-Authored-By: Brandur Leach <brandur@brandur.org> --------- Co-authored-by: Brandur Leach <brandur@brandur.org>
- Loading branch information
Showing
9 changed files
with
688 additions
and
400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.