Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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

try {
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 ?

@@ -15,19 +16,23 @@ export default class CancelationRequest {

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

}
}

then() {
return this._pendingWork.then(...arguments);
}

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

@@ -245,9 +230,16 @@ class Watcher extends EventEmitter {

this._quittingPromise = (async () => {
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.

} 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

@@ -1027,7 +1027,7 @@ describe('Builder', function() {
});

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

@@ -122,7 +122,7 @@ describe('Watcher', function() {
});

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

@@ -208,6 +209,7 @@ describe('Watcher', function() {
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.

@@ -199,8 +164,28 @@ class Watcher extends EventEmitter {
logger.debug('buildFailure');
this.emit('buildFailure', err);
}
);
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