Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions internal/upstream/limiter/limiter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,14 @@ func (c *parkedCall) release(t *testing.T) {
// calls parked in whatever slot they win, freeing the held slot can put exactly
// ONE of them past admission, so the two admissions can never be reported
// concurrently and the order the test reads is the order the limiter granted.
//
// Parking is what makes that true, and it is the whole point of the helper. An
// earlier version had each caller release as soon as it was admitted, which is
// the very thing that wakes the next waiter: both callers then finished while
// the test was still parked, both result channels went ready at once, and the
// select below picked between them at random. That measured which goroutine got
// scheduled first, not which one the limiter granted first, and it failed on
// loaded runners for no reason at all.
func TestFastPathDoesNotOvertakeAQueue(t *testing.T) {
l := New(ScopeServer, "srv", Limits{Max: 1, QueueSize: 4, QueueTimeout: time.Hour})

Expand Down
Loading