Skip to content

Commit ff6db49

Browse files
committed
fix(run-engine): reschedule batch drain on candidateIds count, not pendingRuns
After the ClickHouse migration, pendingRuns.length is post-status-guard; runs that have already left PENDING_VERSION between the CH lookup and the Postgres refetch get filtered out. Using it as the more-work signal under-reports when more candidates exist on the worker and stops short. Switch to candidateIds.length, which is the raw lookup result.
1 parent 48c2bc4 commit ff6db49

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

internal-packages/run-engine/src/engine/systems/pendingVersionSystem.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,12 @@ export class PendingVersionSystem {
176176
});
177177
}
178178

179-
//enqueue more if needed
180-
if (pendingRuns.length > maxCount) {
179+
// Reschedule when the lookup returned a full-plus-one batch — that's
180+
// the signal there are more candidates to drain. Use `candidateIds`
181+
// (the raw lookup result) rather than `pendingRuns` (post-status-guard)
182+
// because runs that already left PENDING_VERSION shouldn't suppress
183+
// the next batch.
184+
if (candidateIds.length > maxCount) {
181185
await this.scheduleResolvePendingVersionRuns(backgroundWorkerId);
182186
}
183187
}

0 commit comments

Comments
 (0)