gateway: a request whose agent goes while it waits for room ends its wait before giving its place back
TestMaxRPMAgentGoneWhileWaiting went red on ubuntu CI at 588f87a12
("1 still waiting for room after the agent went"). On a cancel, wait gave
the place back first and stopped its timer only in a defer after, so the
test could see the place back while the wait was still registered. The
wait now stops its timer, then gives the place back.
Run:
- Injected a 100ms pause after giveBack: the old order is red 3 of 3,
the new order green 3 of 3.
- go test -race -run TestMaxRPM -count=10 ./internal/gateway: ok.
- go test ./... -count=1 -timeout 45m (load ~200): every package ok except
internal/gui, where TestMainWindowCorners and TestMainWindowRightToLeft
were killed at their deadline (#1936, #2645). Run alone: ok in 36s.
- gofmt -l clean.
This commit is contained in:
@@ -177,6 +177,9 @@ func (l *rpms) wait(ctx context.Context, who string, limit int, longest time.Dur
|
||||
case <-c:
|
||||
return d, nil
|
||||
case <-ctx.Done():
|
||||
// the wait ends before its place is given back, so once the place
|
||||
// is back nothing is left to send it
|
||||
stop()
|
||||
l.giveBack(who, at)
|
||||
return rpmNow().Sub(now), ctx.Err()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user