Skip to content

Commit a829dfd

Browse files
authored
Improve interruptAndCheck behavior (#1787)
1 parent f8dadea commit a829dfd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/langium/src/utils/promise-utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ export async function interruptAndCheck(token: CancellationToken): Promise<void>
7878
if (current - lastTick >= globalInterruptionPeriod) {
7979
lastTick = current;
8080
await delayNextTick();
81+
// prevent calling delayNextTick every iteration of loop
82+
// where delayNextTick takes up the majority or all of the
83+
// globalInterruptionPeriod itself
84+
lastTick = performance.now();
8185
}
8286
if (token.isCancellationRequested) {
8387
throw OperationCancelled;

0 commit comments

Comments
 (0)