X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2Fabstract-worker.ts;h=e10521fcbc7808eeffeb778aa8dfb13ce0eb680e;hb=fc6ff28183891512e784b8ddd268eeaf326da7d2;hp=b8e4b167602dd14306b595d0f1564b13009f636c;hpb=ae036c3e73796126b7f1138129b6b18ef6bcef8c;p=poolifier.git diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index b8e4b167..e10521fc 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -100,7 +100,8 @@ export abstract class AbstractWorker< this.checkTaskFunctions(taskFunctions) this.checkWorkerOptions(this.opts) if (!this.isMain) { - this.getMainWorker().once('message', this.handleReadyMessage.bind(this)) + // Should be once() but Node.js on windows has a bug that prevents it from working + this.getMainWorker().on('message', this.handleReadyMessage.bind(this)) } } @@ -367,13 +368,13 @@ export abstract class AbstractWorker< * * @param message - The kill message. */ - protected handleKillMessage (message: MessageValue): void { + protected handleKillMessage (_message: MessageValue): void { this.stopCheckActive() if (isAsyncFunction(this.opts.killHandler)) { (this.opts.killHandler?.() as Promise) .then(() => { this.sendToMainWorker({ kill: 'success' }) - return null + return undefined }) .catch(() => { this.sendToMainWorker({ kill: 'failure' })