Skip to content

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

Open
stefanpenner wants to merge 1 commit into
mainfrom
retries
Open

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

Conversation

@stefanpenner
Copy link
Copy Markdown
Contributor

@stefanpenner stefanpenner commented Mar 27, 2020

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

Comment thread lib/builder.ts
if (RetryCancellationRequest.isRetry(e)) {
this._cancelationRequest = undefined;
await new Promise((resolve, reject) => {
setTimeout(() => {
Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread lib/builder.ts
await pipeline;
this.buildHeimdallTree(this.outputNodeWrapper);
} catch (e) {
if (RetryCancellationRequest.isRetry(e)) {
Copy link
Copy Markdown
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

Comment thread lib/builder.ts
} catch(e) {
reject(e);
}
}, e.retryIn);
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread lib/watcher.ts
try {
await this.watcherAdapter.quit();
await Promise.all([
this.builder.cancel(),
Copy link
Copy Markdown
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.

Comment thread lib/watcher.ts
} catch (e) {
} finally {
try {
if (this._nextBuild) {
Copy link
Copy Markdown
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

Comment thread test/builder_test.js Outdated

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

Choose a reason for hiding this comment

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

TODO: fix

Comment thread test/watcher_test.js Outdated

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

Choose a reason for hiding this comment

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

TODO: fix

Comment thread test/watcher_test.js
await first.resolve();
await second.resolve();

await firstBuild;
Copy link
Copy Markdown
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.

Comment thread lib/watcher.ts
}
);
return buildPromise;
).finally(() => this._activeBuild = false);
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

Comment thread lib/watcher.ts
if (this._nextBuild) {
return this._nextBuild.promise;
} else {
return this._currentBuild;
Copy link
Copy Markdown
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