Skip to content

test: fix race in the throttle cap spec - #84

Open
JNK234 wants to merge 1 commit into
mainfrom
fix/throttle-spec-race
Open

JNK234 wants to merge 1 commit into
mainfrom
fix/throttle-spec-race

Conversation

@JNK234

@JNK234 JNK234 commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

The push-triggered CI run on #83 failed in RequestThrottleSpec ("permits beyond the cap wait"): only 2 may run at once, saw 1. It's a race in the test, not a throttle bug.

The test waits until running == 2 and then asserts peak == 2. A request increments running before it updates peak, so on a slow runner the check can happen between the two and read peak = 1.

The fix waits on peak == 2 instead, then asserts running == 2. That still proves the cap holds, and the later assert still checks the cap for the whole run. No production code changes.

The spec waited for running == 2 and then asserted peak == 2, but a
request raises running before it records peak, so a slow runner could
read peak = 1. Wait on peak instead and assert running holds at the cap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant