Refactor/single process multiple services#785
Draft
renatomaia wants to merge 24 commits into
Draft
Conversation
3cf0490 to
758ef1a
Compare
… in 'Tick' functions
758ef1a to
426dd48
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New service runtime pieces:
ServicesSupervisorto manage several services together in a single-process, handle OS signals, propagate stop/reload, and join child errors.Overview of changes introduced:
context.Context. There is noservice.stoppingstage any more. Moreover, there is no more aStopmethod to notify service that is shall terminate. Services must watch the propercontext.Context.Doneto do what was done inStop(ex. terminate a HTTP server or a time ticker).Stop).SIGINT,SIGTERM). The support forSIGHUPwas not used and was discarded.A custom
Alivemethod for each service as not used and was removed. The${process}/livezendpoint is implemented by the Supervisor and becomestruewhenever the Supervisor starts running the services, regardless whether they are fully up or not. It becomesfalsewhenever the Supervisor is stopped, regardless whether the services have fully terminated or not.The
Reloadmethod was not used and was discarded.[THIS IS NOT GOOD] A new
Teardownmethod is introduced to allow services to release resources before the Supervisor finishes the system process. The only service using this is the Advancer that uses it to close the Machine Manager.TickServiceTemplatefor tick-based services:HTTPServiceTemplatefor HTTP-backed services:Error handling and lifecycle behavior were tightened throughout:
errors.Joininstead of[]error.