X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fcluster%2Ffixed.ts;h=b74f034bc199d9d4e89f77f0856b00855cf1685a;hb=ca438ccd304d3b139305672f1d9148b5378b62f1;hp=d457b37790d0537c80e17635fcbb76c4b4599b6d;hpb=ae036c3e73796126b7f1138129b6b18ef6bcef8c;p=poolifier.git diff --git a/src/pools/cluster/fixed.ts b/src/pools/cluster/fixed.ts index d457b377..b74f034b 100644 --- a/src/pools/cluster/fixed.ts +++ b/src/pools/cluster/fixed.ts @@ -61,6 +61,7 @@ export class FixedClusterPool< /** @inheritDoc */ protected async destroyWorkerNode (workerNodeKey: number): Promise { + this.flagWorkerNodeAsNotReady(workerNodeKey) this.flushTasksQueue(workerNodeKey) // FIXME: wait for tasks to be finished const workerNode = this.workerNodes[workerNodeKey] @@ -74,6 +75,7 @@ export class FixedClusterPool< worker.kill() }) await this.sendKillMessageToWorker(workerNodeKey) + workerNode.removeAllListeners() worker.disconnect() await waitWorkerExit } @@ -85,7 +87,7 @@ export class FixedClusterPool< ): void { this.workerNodes[workerNodeKey].worker.send({ ...message, - workerId: this.workerNodes[workerNodeKey].info.id as number + workerId: this.getWorkerInfo(workerNodeKey).id as number }) }