Add a sanity check at worker implementation options check
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 29 Aug 2021 13:31:58 +0000 (15:31 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 29 Aug 2021 13:31:58 +0000 (15:31 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/worker/WorkerFactory.ts

index d97e9604da5fe987eb63d0ce556ed6325fd391d8..55cb1da7a55fe2cf50d5b282d1ba703aa8f54c4a 100644 (file)
@@ -19,7 +19,7 @@ export default class WorkerFactory {
       throw new Error('Trying to get a worker implementation outside the main thread');
     }
     options = options ?? {} as WorkerOptions;
-    options.startDelay = options.startDelay ?? Constants.WORKER_START_DELAY;
+    options.startDelay = options?.startDelay ?? Constants.WORKER_START_DELAY;
     options.poolOptions = options?.poolOptions ?? {} as PoolOptions<Worker>;
     options?.messageHandler && (options.poolOptions.messageHandler = options.messageHandler);
     let workerImplementation: WorkerAbstract = null;