fix: revert incorrect change
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 27 Aug 2023 10:57:51 +0000 (12:57 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 27 Aug 2023 10:57:51 +0000 (12:57 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/abstract-pool.ts

index 2a28893d241614bc4cdbdfcbbc623623e7ae947c..2820f8e3d403778c6c6c9deccb8d568bc8050863 100644 (file)
@@ -1301,7 +1301,11 @@ export abstract class AbstractPool<
           ...(sourceWorkerNode.popTask() as Task<Data>),
           workerId: workerNode.info.id as number
         }
-        if (this.tasksQueueSize(workerNodeKey) === 0) {
+        if (
+          this.tasksQueueSize(workerNodeKey) === 0 &&
+          workerNode.usage.tasks.executing <
+            (this.opts.tasksQueueOptions?.concurrency as number)
+        ) {
           this.executeTask(workerNodeKey, task)
         } else {
           this.enqueueTask(workerNodeKey, task)