X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fcluster%2Ffixed.ts;h=e1caf252332f7d0103a77a9470b1526a62613e78;hb=6e9d10db05ac2bbc85373195a5c885d2492fee61;hp=b522947f25cb6f9497c7935fdcd131d1747e8b34;hpb=46eec6ddf0904bb757d333c364885f1f6980caeb;p=poolifier.git diff --git a/src/pools/cluster/fixed.ts b/src/pools/cluster/fixed.ts index b522947f..e1caf252 100644 --- a/src/pools/cluster/fixed.ts +++ b/src/pools/cluster/fixed.ts @@ -49,12 +49,14 @@ export class FixedClusterPool< super(numberOfWorkers, filePath, opts) } + /** @inheritdoc */ protected setupHook (): void { setupMaster({ exec: this.filePath }) } + /** @inheritdoc */ protected isMain (): boolean { return isMaster } @@ -65,6 +67,7 @@ export class FixedClusterPool< worker.kill() } + /** @inheritdoc */ protected sendToWorker (worker: Worker, message: MessageValue): void { worker.send(message) } @@ -77,10 +80,12 @@ export class FixedClusterPool< worker.on('message', listener) } + /** @inheritdoc */ protected createWorker (): Worker { return fork(this.opts.env) } + /** @inheritdoc */ protected afterWorkerSetup (worker: Worker): void { // Listen worker messages. this.registerWorkerMessageListener(worker, super.workerListener())