perf: pre-create worker if needed at the end of task execution
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 14 Oct 2024 12:24:39 +0000 (14:24 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 14 Oct 2024 12:24:39 +0000 (14:24 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
.github/dependabot.yml
biome.json
src/pools/abstract-pool.ts

index 6b87c90d439ada1f5e2bb75805663dd02b94c720..27c9466cd6648140c9853b1762086aa721ce7aa9 100644 (file)
@@ -19,6 +19,9 @@ updates:
         update-types:
           - 'minor'
           - 'patch'
+        commitlint:
+          patterns:
+            - '@commitlint/*'
     labels:
       - 'dependencies'
     reviewers:
index 0ac299935138250144c409ee4c55f4824fd1bf52..0a62520f879265dce64aba1af3d3d86dfc138e05 100644 (file)
   },
   "javascript": {
     "formatter": {
+      "arrowParentheses": "asNeeded",
       "quoteStyle": "single",
-      "trailingCommas": "es5",
       "semicolons": "asNeeded",
-      "arrowParentheses": "asNeeded"
+      "trailingCommas": "es5"
     }
   },
   "json": {
index 7bbdb8ac2b3fa23d09de50be2924b6c8ce17d8a7..72507108c0a1f669a443167f2c10b88263ea22c9 100644 (file)
@@ -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()
+      }
     }
   }