perf: stop continuous task stealing at task executing
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 26 Aug 2023 14:29:57 +0000 (16:29 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 26 Aug 2023 14:29:57 +0000 (16:29 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/worker-node.ts

index fbd00096a769d53cd5d3d9415fae64c428cfb3ee..079881b94cf165a16f4fe2e6be9c4223579a8346 100644 (file)
@@ -180,8 +180,7 @@ implements IWorkerNode<Worker, Data> {
   private async startOnEmptyQueue (): Promise<void> {
     if (
       this.onEmptyQueueCount > 0 &&
-      this.usage.tasks.executing > 0 &&
-      this.tasksQueue.size > 0
+      (this.usage.tasks.executing > 0 || this.tasksQueue.size > 0)
     ) {
       this.onEmptyQueueCount = 0
       return