Tests: stabilize shard-2 queue and channel state

This commit is contained in:
Vignesh Natarajan
2026-03-28 23:33:49 -07:00
committed by Vignesh
parent 9c185faba9
commit 4d54376483
2 changed files with 15 additions and 1 deletions

View File

@@ -254,6 +254,18 @@ export function clearCommandLane(lane: string = CommandLane.Main) {
return removed;
}
/**
* Test-only hard reset that discards all queue state, including preserved
* queued work from previous generations. Use this when a suite needs an
* isolated baseline across shared-worker runs.
*/
export function resetCommandQueueStateForTest(): void {
const queueState = getQueueState();
queueState.gatewayDraining = false;
queueState.lanes.clear();
queueState.nextTaskId = 1;
}
/**
* Reset all lane runtime state to idle. Used after SIGUSR1 in-process
* restarts where interrupted tasks' finally blocks may not run, leaving