From 1d5588f7a7157f4214c0f326c294cd966525bee3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 14 Oct 2024 14:24:39 +0200 Subject: [PATCH] perf: pre-create worker if needed at the end of task execution MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .github/dependabot.yml | 3 +++ biome.json | 4 ++-- src/pools/abstract-pool.ts | 7 ++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6b87c90d..27c9466c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -19,6 +19,9 @@ updates: update-types: - 'minor' - 'patch' + commitlint: + patterns: + - '@commitlint/*' labels: - 'dependencies' reviewers: diff --git a/biome.json b/biome.json index 0ac29993..0a62520f 100644 --- a/biome.json +++ b/biome.json @@ -17,10 +17,10 @@ }, "javascript": { "formatter": { + "arrowParentheses": "asNeeded", "quoteStyle": "single", - "trailingCommas": "es5", "semicolons": "asNeeded", - "arrowParentheses": "asNeeded" + "trailingCommas": "es5" } }, "json": { diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 7bbdb8ac..72507108 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -675,9 +675,7 @@ export abstract class AbstractPool< workerNode.info.dynamic = true if ( this.workerChoiceStrategiesContext?.getPolicy().dynamicWorkerReady === - true || - this.workerChoiceStrategiesContext?.getPolicy().dynamicWorkerUsage === - true + true ) { workerNode.info.ready = true } @@ -1221,6 +1219,9 @@ export abstract class AbstractPool< // FIXME: cannot be theoretically undefined. Schedule in the next tick to avoid race conditions? // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition workerNode?.emit('taskFinished', taskId) + if (this.shallCreateDynamicWorker()) { + this.createAndSetupDynamicWorkerNode() + } } } -- 2.34.1