Services: Pass running services across watch iterations - #488
Merged
Conversation
aomarks
force-pushed
the
service.10
branch
2 times, most recently
from
October 28, 2022 18:06
7656e0f to
bd81657
Compare
… and aggregate errors
Member
Author
|
Rebased (sorry if was already reviewing) |
justinfagnani
approved these changes
Oct 28, 2022
|
|
||
| /** | ||
| * Return the fingerprint of this service. If the fingerprint is not yet | ||
| * computed, or if the service is stopped/failed/detached, returns undefined. |
There was a problem hiding this comment.
Why shouldn't it be an error to request a fingerprint before it's available?
Member
Author
There was a problem hiding this comment.
Yeah, we probably should. Done.
| */ | ||
| async execute(): Promise<Result<void, Failure[]>> { | ||
| async execute(): Promise<Result<ServiceMap, Failure[]>> { | ||
| // TOOD(aomarks) If we have any running services from a previous watch |
There was a problem hiding this comment.
Do you plan on keeping services running across edits tot he wireit configs?
Member
Author
There was a problem hiding this comment.
Yep, as long as the fingerprint stays the same for a service, we can keep it running. So if you change something that would require the service to restart, it will do so. Otherwise no need to restart it.
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.
Implements the basic logic for passing running services across watch mode iterations:
The top-level
executemethod now returns a map of the services that are still running at the end of the execution.We pass that service map to the next iteration, and pass the previous version of each service into its new version.
As soon as a service knows its fingerprint, we check if it matches the previous version's fingerprint. If it does match, we "adopt" it instead of starting a new process. If it does not match, we shut it down, and then continue as normal (effectively restarting it).
Still a few cases to handle here, which are in TODOs, but will do in followup PRs.
Part of #33