refactor: stricter worker node constructor checks
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 19 Aug 2023 22:27:19 +0000 (00:27 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 19 Aug 2023 22:27:19 +0000 (00:27 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/worker-node.ts

index 57628bf72c74c28d18764e8d6fed067f687e6e71..43c5de7123d0beeee5ce2602f779bc4aa2878ce3 100644 (file)
@@ -53,9 +53,9 @@ implements IWorkerNode<Worker, Data> {
         'Cannot construct a worker node without a pool maximum size'
       )
     }
-    if (isNaN(poolMaxSize)) {
+    if (!Number.isSafeInteger(poolMaxSize)) {
       throw new TypeError(
-        'Cannot construct a worker node with a NaN pool maximum size'
+        'Cannot construct a worker node with a pool maximum size that is not an integer'
       )
     }
     this.worker = worker