[WIP][Bugfix] Mid-build Retries should not cause spurious errors.#458
[WIP][Bugfix] Mid-build Retries should not cause spurious errors.#458stefanpenner wants to merge 1 commit intomainfrom
Conversation
| if (RetryCancellationRequest.isRetry(e)) { | ||
| this._cancelationRequest = undefined; | ||
| await new Promise((resolve, reject) => { | ||
| setTimeout(() => { |
There was a problem hiding this comment.
TODO: promise based timeout helper
There was a problem hiding this comment.
TODO: cancel timer during debounce period
| await pipeline; | ||
| this.buildHeimdallTree(this.outputNodeWrapper); | ||
| } catch (e) { | ||
| if (RetryCancellationRequest.isRetry(e)) { |
There was a problem hiding this comment.
Implement some sort of retry limit, to prevent infinite builds
| } catch(e) { | ||
| reject(e); | ||
| } | ||
| }, e.retryIn); |
There was a problem hiding this comment.
Verify the new approach to use cancellation/retries to implement the debounce works
There was a problem hiding this comment.
consider retryIn -> debounce ?
| throwIfRequested() { | ||
| if (this.isCanceled) { | ||
| throw new CancelationError('Build Canceled'); | ||
| throw this._cancelationError; |
There was a problem hiding this comment.
TODO: Add test
| } | ||
|
|
||
| cancel() { | ||
| cancel(cancelationError?: CancelationError) { |
There was a problem hiding this comment.
TODO: Add test
| try { | ||
| await this.watcherAdapter.quit(); | ||
| await Promise.all([ | ||
| this.builder.cancel(), |
There was a problem hiding this comment.
TODO: verify this doesn't throw under normal operation.
| } catch (e) { | ||
| } finally { | ||
| try { | ||
| if (this._nextBuild) { |
There was a problem hiding this comment.
TODO: this is yucky
test/builder_test.js
Outdated
|
|
||
| describe('heimdall stats', function() { | ||
| it('produces stats', async function() { | ||
| it.skip('produces stats', async function() { |
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() { |
| await first.resolve(); | ||
| await second.resolve(); | ||
|
|
||
| await firstBuild; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
TODO: technically we support node 8 still, so this needs to use syntax finally
|
Sorry for the conflicts, will need to rebase on top of #459 and revert the revert (I think). |
|
@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; |
There was a problem hiding this comment.
consider .then() so that external unhandled rejections occure.
Uh oh!
There was an error while loading. Please reload this page.