Ensure final cell execution update is not delayed
This commit is contained in:
parent
8b598d67ed
commit
ff681a5db2
|
@ -834,7 +834,6 @@ suite('Notebook API tests', function () {
|
|||
assert.ok(cell.executionSummary);
|
||||
assert.strictEqual(cell.executionSummary!.success, true);
|
||||
assert.strictEqual(typeof cell.executionSummary!.executionOrder, 'number');
|
||||
|
||||
});
|
||||
|
||||
test('initialize executionSummary', async () => {
|
||||
|
|
|
@ -468,6 +468,10 @@ class NotebookCellExecutionTask extends Disposable {
|
|||
runEndTime: endTime,
|
||||
lastRunSuccess: success
|
||||
});
|
||||
|
||||
// The last update needs to be ordered correctly and applied immediately,
|
||||
// so we use updateSoon and immediately flush.
|
||||
that._collector.flush();
|
||||
},
|
||||
|
||||
clearOutput(cell?: vscode.NotebookCell): Thenable<void> {
|
||||
|
@ -511,13 +515,17 @@ class TimeoutBasedCollector<T> {
|
|||
this.batch.push(item);
|
||||
if (!this.waitPromise) {
|
||||
this.waitPromise = timeout(this.delay).then(() => {
|
||||
this.waitPromise = undefined;
|
||||
const batch = this.batch;
|
||||
this.batch = [];
|
||||
return this.callback(batch);
|
||||
return this.flush();
|
||||
});
|
||||
}
|
||||
|
||||
return this.waitPromise;
|
||||
}
|
||||
|
||||
flush(): void | Promise<void> {
|
||||
this.waitPromise = undefined;
|
||||
const batch = this.batch;
|
||||
this.batch = [];
|
||||
return this.callback(batch);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue