X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fabstract-pool.ts;h=695c43b30d3f6697a5407a60ff3ceeca05248350;hb=dcb582f3a195c6c7040b92c1852d7c38752209a8;hp=76f5bfdc24d47820f9cb2aaaac8ca387a4670a55;hpb=63220255217edbd1d0fd039a0dcb3e141739f43a;p=poolifier.git diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 76f5bfdc..695c43b3 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -2,7 +2,7 @@ import type { MessageValue, PromiseWorkerResponseWrapper } from '../utility-types' -import { EMPTY_FUNCTION, EMPTY_LITERAL } from '../utils' +import { EMPTY_FUNCTION, EMPTY_OBJECT_LITERAL } from '../utils' import { isKillBehavior, KillBehaviors } from '../worker/worker-options' import type { PoolOptions } from './pool' import { PoolEmitter } from './pool' @@ -208,7 +208,7 @@ export abstract class AbstractPool< const res = this.internalExecute(worker, this.nextMessageId) this.checkAndEmitBusy() this.sendToWorker(worker, { - data: data ?? (EMPTY_LITERAL as Data), + data: data ?? (EMPTY_OBJECT_LITERAL as Data), id: this.nextMessageId }) ++this.nextMessageId @@ -218,7 +218,11 @@ export abstract class AbstractPool< /** {@inheritDoc} */ public async destroy (): Promise { - await Promise.all(this.workers.map(worker => this.destroyWorker(worker))) + await Promise.all( + this.workers.map(async worker => { + await this.destroyWorker(worker) + }) + ) } /**