fix(core): wait for tasks to be scheduled before checking for work (#8840)

Ensure task are scheduled before checking if there is some work to do,
else it can occur that tasks are scheduled, but no check for work is triggered
until the next task completes.

Closes #8888.
This commit is contained in:
Denis Frenademetz 2022-02-11 21:23:34 +01:00 committed by GitHub
parent 5bf37f00bd
commit 619a7e825e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -384,6 +384,10 @@ export class TaskOrchestrator {
);
await this.tasksSchedule.scheduleNextTasks();
// release blocked threads
this.waitingForTasks.forEach((f) => f(null));
this.waitingForTasks.length = 0;
}
private complete(
@ -408,9 +412,6 @@ export class TaskOrchestrator {
);
}
}
this.waitingForTasks // release blocked threads
.forEach((f) => f(null));
this.waitingForTasks.length = 0;
}
//endregion Lifecycle