X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2Fabstract-worker.ts;h=54358ee64b58adfb1a4f9275f53a04185ea878e8;hb=adc9d8049cd47151ade236564b2041116f5b0345;hp=9ec38feda57cdccc6cde6598943c2b157e439ed4;hpb=8accb8d5d2f8a6d77017a421938796623ac2b239;p=poolifier.git diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index 9ec38fed..54358ee6 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -84,7 +84,7 @@ export abstract class AbstractWorker< ): void { if (value.data !== undefined && value.id !== undefined) { // Here you will receive messages - if (this.opts.async) { + if (this.opts.async === true) { this.runInAsyncScope(this.runAsync.bind(this), this, fn, value) } else { this.runInAsyncScope(this.run.bind(this), this, fn, value) @@ -104,9 +104,6 @@ export abstract class AbstractWorker< this.opts.killBehavior = opts.killBehavior ?? DEFAULT_KILL_BEHAVIOR this.opts.maxInactiveTime = opts.maxInactiveTime ?? DEFAULT_MAX_INACTIVE_TIME - /** - * Whether the worker is working asynchronously or not. - */ this.opts.async = !!opts.async } @@ -139,7 +136,7 @@ export abstract class AbstractWorker< protected abstract sendToMainWorker (message: MessageValue): void /** - * Check to see if the worker should be terminated, because its living too long. + * Checks if the worker should be terminated, because its living too long. */ protected checkAlive (): void { if (