Skip to content

[WIP][Bugfix] Mid-build Retries should not cause spurious errors.#458

Open
stefanpenner wants to merge 1 commit intomainfrom
retries
Open

[WIP][Bugfix] Mid-build Retries should not cause spurious errors.#458
stefanpenner wants to merge 1 commit intomainfrom
retries

Conversation

@stefanpenner
Copy link
Contributor

@stefanpenner stefanpenner commented Mar 27, 2020

  • fix todos
  • cleanup
  • retry limit
  • add additional tests

if (RetryCancellationRequest.isRetry(e)) {
this._cancelationRequest = undefined;
await new Promise((resolve, reject) => {
setTimeout(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: promise based timeout helper

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: cancel timer during debounce period

await pipeline;
this.buildHeimdallTree(this.outputNodeWrapper);
} catch (e) {
if (RetryCancellationRequest.isRetry(e)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implement some sort of retry limit, to prevent infinite builds

} catch(e) {
reject(e);
}
}, e.retryIn);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Verify the new approach to use cancellation/retries to implement the debounce works

Copy link
Contributor Author

Choose a reason for hiding this comment

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

consider retryIn -> debounce ?

throwIfRequested() {
if (this.isCanceled) {
throw new CancelationError('Build Canceled');
throw this._cancelationError;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: Add test

}

cancel() {
cancel(cancelationError?: CancelationError) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: Add test

try {
await this.watcherAdapter.quit();
await Promise.all([
this.builder.cancel(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: verify this doesn't throw under normal operation.

} catch (e) {
} finally {
try {
if (this._nextBuild) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: this is yucky


describe('heimdall stats', function() {
it('produces stats', async function() {
it.skip('produces stats', async function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: fix


describe('change', function() {
it('on change, rebuild is invoked', async function() {
it.skip('on change, rebuild is invoked', async function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: fix

await first.resolve();
await second.resolve();

await firstBuild;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding this, reproduces the regression that motivated this fix

TODO: leave comment/explicit test so future travelers understand the importance of this.

}
);
return buildPromise;
).finally(() => this._activeBuild = false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: technically we support node 8 still, so this needs to use syntax finally

@rwjblue
Copy link
Member

rwjblue commented Mar 30, 2020

Sorry for the conflicts, will need to rebase on top of #459 and revert the revert (I think).

@stefanpenner
Copy link
Contributor Author

@rwjblue yup, thats reasonable. I'll incorporate the revert revert in this PR shortly

if (this._nextBuild) {
return this._nextBuild.promise;
} else {
return this._currentBuild;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

consider .then() so that external unhandled rejections occure.

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