Services: Fix issue with caching in watch mode due to missing promise resolution - #497
Merged
Conversation
justinfagnani
approved these changes
Nov 1, 2022
| case 'unstarted': | ||
| case 'depsStarting': { | ||
| this._state = {id: 'stopped'}; | ||
| this._terminated.resolve({ok: true, value: undefined}); |
Collaborator
There was a problem hiding this comment.
Why don't these need to be resolved above?
If these are pre-conditions for entering the stopped state, it'd be nice if they could be checked / enforced there. That would require abstracting over entering states so that you don't just do:
this._state = {id: 'stopped'};but
this._enterStoppedState();etc
Member
Author
There was a problem hiding this comment.
The above cases are going to the stopping state. We don't enter stopped and resolve those promises until the child is killed (or never starts).
I do like the _enterStoppedState idea though, since there is another spot above where we enter that state. Also renamed _fail to _enterFailedState to match.
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.
I've started testing services for real on webcomponents.org, and I hit a bug where watch mode could get stuck because of some missing promise resolution. We were resolving the promises that indicate when a service is done only when it succeeded or failed, but not when it was aborted/didn't need to run at all.
Part of #33