X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fthread%2Ffixed.ts;h=32107e48635314e25269cc37e2c0ad7fdd3fcd75;hb=46e29227a97fe04f886969199f1c14338af50543;hp=a193091f9fc7e1c4ac16c92a359eac470c0f6e78;hpb=8ad621cc1d32ed396fca3ef2ec48337e42d2dcc2;p=poolifier.git diff --git a/src/pools/thread/fixed.ts b/src/pools/thread/fixed.ts index a193091f..32107e48 100644 --- a/src/pools/thread/fixed.ts +++ b/src/pools/thread/fixed.ts @@ -67,7 +67,7 @@ export class FixedThreadPool< resolve() }) }) - this.sendToWorker(workerNodeKey, { kill: true, workerId: worker.threadId }) + await this.sendKillMessageToWorker(workerNodeKey, worker.threadId) workerNode.closeChannel() await worker.terminate() await waitWorkerExit @@ -80,7 +80,7 @@ export class FixedThreadPool< transferList?: TransferListItem[] ): void { ( - this.getWorkerInfo(workerNodeKey).messageChannel as MessageChannel + this.workerNodes[workerNodeKey].messageChannel as MessageChannel ).port1.postMessage(message, transferList) } @@ -88,7 +88,7 @@ export class FixedThreadPool< protected sendStartupMessageToWorker (workerNodeKey: number): void { const worker = this.workerNodes[workerNodeKey].worker const port2: MessagePort = ( - this.getWorkerInfo(workerNodeKey).messageChannel as MessageChannel + this.workerNodes[workerNodeKey].messageChannel as MessageChannel ).port2 worker.postMessage( { @@ -106,7 +106,7 @@ export class FixedThreadPool< listener: (message: MessageValue) => void ): void { ( - this.getWorkerInfo(workerNodeKey).messageChannel as MessageChannel + this.workerNodes[workerNodeKey].messageChannel as MessageChannel ).port1.on('message', listener) } @@ -128,16 +128,6 @@ export class FixedThreadPool< return WorkerTypes.thread } - /** @inheritDoc */ - protected get minSize (): number { - return this.numberOfWorkers - } - - /** @inheritDoc */ - protected get maxSize (): number { - return this.numberOfWorkers - } - /** @inheritDoc */ protected get busy (): boolean { return this.internalBusy()