From: Jérôme Benoit Date: Sat, 18 Mar 2023 17:34:43 +0000 (+0100) Subject: fix: fix default worker data value X-Git-Tag: v2.3.9~1 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e5a5c0fc68a38b7d6316cc573c34313aa6ec30e9;p=poolifier.git fix: fix default worker data value Signed-off-by: Jérôme Benoit --- diff --git a/.eslintrc.js b/.eslintrc.js index 6dcbf08c..4852d04f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -42,6 +42,7 @@ module.exports = defineConfig({ 'ctx', 'ecma', 'enum', + 'esm', 'fibonacci', 'fs', 'inheritDoc', diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 3cb6c1f7..6531d661 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -208,7 +208,8 @@ export abstract class AbstractPool< const res = this.internalExecute(worker, this.nextMessageId) this.checkAndEmitBusy() this.sendToWorker(worker, { - data, + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + data: data ?? ({} as Data), id: this.nextMessageId }) ++this.nextMessageId