Ensure that workerSet always properly start a worker at init
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 2 Jun 2022 22:41:53 +0000 (00:41 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 2 Jun 2022 22:41:53 +0000 (00:41 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/worker/WorkerSet.ts

index 6e890902d8f8c769e726a262e5c013c39334b604..73014977070673616607821928e86ad0bd88af0d 100644 (file)
@@ -46,6 +46,7 @@ export default class WorkerSet extends WorkerAbstract<WorkerData> {
       throw new Error("Cannot add a WorkerSet element: workers' set does not exist");
     }
     if (
+      this.workerSet.size === 0 ||
       this.getLastWorkerSetElement().numberOfWorkerElements >= this.workerOptions.elementsPerWorker
     ) {
       await this.startWorker();