Issue 160 ci unit test (#181)
authorAlessandro Pio Ardizio <alessandroardizio94@gmail.com>
Wed, 17 Feb 2021 19:13:21 +0000 (20:13 +0100)
committerGitHub <noreply@github.com>
Wed, 17 Feb 2021 19:13:21 +0000 (20:13 +0100)
* Fix issue 160

* Keep comments

* Keep comments

package.json
src/pools/cluster/dynamic.ts
src/pools/cluster/fixed.ts
src/pools/thread/dynamic.ts
src/pools/thread/fixed.ts

index ceef04b142b5045f4f7ad618ad2626c1547a483c..cf78b829ff2f55f308fb2265cacba6d96efae8bf 100644 (file)
@@ -9,7 +9,7 @@
     "benchmark": "npm run build && node -r source-map-support/register benchmarks/bench.js",
     "benchmark:debug": "npm run build && node -r source-map-support/register --inspect benchmarks/bench.js",
     "benchmark:prod": "npm run build:prod && node -r source-map-support/register benchmarks/bench.js",
-    "test": "npm run build && nyc mocha -r source-map-support/register --exit --timeout 20000 'tests/**/*.test.js'",
+    "test": "npm run build && nyc mocha -r source-map-support/register --exit --timeout 20000 --parallel 'tests/**/*.test.js'",
     "test:debug": "npm run build && mocha -r source-map-support/register --inspect --exit --timeout 20000 'tests/**/*.test.js'",
     "test:prod": "npm run build:prod && nyc mocha -r source-map-support/register --exit --timeout 20000 'tests/**/*.test.js'",
     "sonar": "sonar-scanner",
index e97ab4a9be2fdbe536fd8ac5e6fa8ae65ea1b41d..aa883bfa194afd50f3b68ffaee40dbbd5096ca1b 100644 (file)
@@ -68,7 +68,6 @@ export class DynamicClusterPool<
         tasksInProgress === 0
       ) {
         // Kill received from the worker, means that no new tasks are submitted to that worker for a while ( > maxInactiveTime)
-        this.sendToWorker(workerCreated, { kill: 1 })
         void this.destroyWorker(workerCreated)
       }
     })
index b2724426a02111108b33debcaa3c116fe9e2b0c5..7cc3bf53950870a0ac2ee6e1a99871bfb72e4214 100644 (file)
@@ -59,6 +59,7 @@ export class FixedClusterPool<
   }
 
   protected destroyWorker (worker: Worker): void {
+    this.sendToWorker(worker, { kill: 1 })
     worker.kill()
   }
 
index 86950b43a6de1d79431a587b0d42f78e91bcb99a..079782eef35211ca163f6484a09b75c4d6b6f484 100644 (file)
@@ -68,7 +68,6 @@ export class DynamicThreadPool<
         tasksInProgress === 0
       ) {
         // Kill received from the worker, means that no new tasks are submitted to that worker for a while ( > maxInactiveTime)
-        this.sendToWorker(workerCreated, { kill: 1 })
         void this.destroyWorker(workerCreated)
       }
     })
index 705f124aea4dda5f35234dea3f8d2f1b59e827a6..8ecf116cb6cc95eb385ee1ab96f7ab1b414b84f8 100644 (file)
@@ -47,6 +47,7 @@ export class FixedThreadPool<
   protected async destroyWorker (
     worker: ThreadWorkerWithMessageChannel
   ): Promise<void> {
+    this.sendToWorker(worker, { kill: 1 })
     await worker.terminate()
   }