From cefac5ba30860fee4cc7feab628d54bdb7601e08 Mon Sep 17 00:00:00 2001 From: Alessandro Pio Ardizio Date: Wed, 17 Feb 2021 20:13:21 +0100 Subject: [PATCH] Issue 160 ci unit test (#181) * Fix issue 160 * Keep comments * Keep comments --- package.json | 2 +- src/pools/cluster/dynamic.ts | 1 - src/pools/cluster/fixed.ts | 1 + src/pools/thread/dynamic.ts | 1 - src/pools/thread/fixed.ts | 1 + 5 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index ceef04b1..cf78b829 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/pools/cluster/dynamic.ts b/src/pools/cluster/dynamic.ts index e97ab4a9..aa883bfa 100644 --- a/src/pools/cluster/dynamic.ts +++ b/src/pools/cluster/dynamic.ts @@ -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) } }) diff --git a/src/pools/cluster/fixed.ts b/src/pools/cluster/fixed.ts index b2724426..7cc3bf53 100644 --- a/src/pools/cluster/fixed.ts +++ b/src/pools/cluster/fixed.ts @@ -59,6 +59,7 @@ export class FixedClusterPool< } protected destroyWorker (worker: Worker): void { + this.sendToWorker(worker, { kill: 1 }) worker.kill() } diff --git a/src/pools/thread/dynamic.ts b/src/pools/thread/dynamic.ts index 86950b43..079782ee 100644 --- a/src/pools/thread/dynamic.ts +++ b/src/pools/thread/dynamic.ts @@ -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) } }) diff --git a/src/pools/thread/fixed.ts b/src/pools/thread/fixed.ts index 705f124a..8ecf116c 100644 --- a/src/pools/thread/fixed.ts +++ b/src/pools/thread/fixed.ts @@ -47,6 +47,7 @@ export class FixedThreadPool< protected async destroyWorker ( worker: ThreadWorkerWithMessageChannel ): Promise { + this.sendToWorker(worker, { kill: 1 }) await worker.terminate() } -- 2.34.1