Skip to content

Services: Fix issue with caching in watch mode due to missing promise resolution - #497

Merged
aomarks merged 2 commits into
servicefrom
service.14
Nov 1, 2022
Merged

Services: Fix issue with caching in watch mode due to missing promise resolution#497
aomarks merged 2 commits into
servicefrom
service.14

Conversation

@aomarks

@aomarks aomarks commented Oct 31, 2022

Copy link
Copy Markdown
Member

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

@aomarks
aomarks requested a review from justinfagnani October 31, 2022 23:53
Comment thread src/execution/service.ts Outdated
case 'unstarted':
case 'depsStarting': {
this._state = {id: 'stopped'};
this._terminated.resolve({ok: true, value: undefined});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@aomarks aomarks Nov 1, 2022

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Edit: typo)

@aomarks
aomarks merged commit cb1e4b6 into service Nov 1, 2022
@aomarks
aomarks deleted the service.14 branch November 1, 2022 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants