implemented that only claim new tasks if queue is empty

Signed-off-by: Hao Luo <howlowck@gmail.com>
This commit is contained in:
Hao Luo
2022-10-13 16:55:36 -05:00
parent 86de58739d
commit d7dad72fdb
@@ -75,7 +75,7 @@ export class TaskWorker {
integrations,
workingDirectory,
additionalTemplateFilters,
concurrentTasksLimit = 10, // Or Infinity
concurrentTasksLimit = 2, // Or Infinity
additionalTemplateGlobals,
} = options;
@@ -98,6 +98,7 @@ export class TaskWorker {
start() {
(async () => {
for (;;) {
await this.taskQueue.onEmpty();
const task = await this.options.taskBroker.claim();
this.taskQueue.add(() => this.runOneTask(task));
}