Skip to content

Commit dc8e7f1

Browse files
committed
fix(execution): apply retiring-worker exclusion to drainQueue pool size check
1 parent 64c38cd commit dc8e7f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

apps/sim/lib/execution/isolated-vm.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,8 @@ function drainQueue() {
980980
while (queueLength() > 0 && totalActiveExecutions < MAX_CONCURRENT) {
981981
const worker = selectWorker()
982982
if (!worker) {
983-
const currentPoolSize = workers.size + spawnInProgress
983+
const activeWorkerCount = [...workers.values()].filter((w) => !w.retiring).length
984+
const currentPoolSize = activeWorkerCount + spawnInProgress
984985
if (currentPoolSize < POOL_SIZE) {
985986
spawnWorker()
986987
.then(() => drainQueue())

0 commit comments

Comments
 (0)