X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fcluster%2Ffixed.ts;h=9470cccd857321388d70e0bf7f09de1a20505cfe;hb=e9dd5b668e17caa64fe1e3e17f481b36a42dffb3;hp=75c0853586c21739ff217eb3be4e63c64e7bb271;hpb=75de9f41ce00bec38febd6d82653d3d82f1bb884;p=poolifier.git diff --git a/src/pools/cluster/fixed.ts b/src/pools/cluster/fixed.ts index 75c08535..9470cccd 100644 --- a/src/pools/cluster/fixed.ts +++ b/src/pools/cluster/fixed.ts @@ -65,7 +65,7 @@ export class FixedClusterPool< // FIXME: wait for tasks to be finished const workerNode = this.workerNodes[workerNodeKey] const worker = workerNode.worker - const waitWorkerExit = new Promise((resolve) => { + const waitWorkerExit = new Promise(resolve => { worker.on('exit', () => { resolve() }) @@ -73,10 +73,7 @@ export class FixedClusterPool< worker.on('disconnect', () => { worker.kill() }) - await this.sendKillMessageToWorker( - workerNodeKey, - workerNode.info.id as number - ) + await this.sendKillMessageToWorker(workerNodeKey) worker.disconnect() await waitWorkerExit } @@ -86,14 +83,16 @@ export class FixedClusterPool< workerNodeKey: number, message: MessageValue ): void { - this.workerNodes[workerNodeKey].worker.send(message) + this.workerNodes[workerNodeKey].worker.send({ + ...message, + workerId: this.workerNodes[workerNodeKey].info.id as number + }) } /** @inheritDoc */ protected sendStartupMessageToWorker (workerNodeKey: number): void { this.sendToWorker(workerNodeKey, { - ready: false, - workerId: this.workerNodes[workerNodeKey].info.id as number + ready: false }) }