rproxy, sww: keep the breaker and stop tests from failing under load (closes #474)
check / check (push) Waiting to run
check / check (push) Waiting to run
The circuit breaker reads the time through a clock the handler holds, which is time.Now outside tests. The test that answers waf's questions with answers rproxy cannot pass on stops that clock, so how long its requests take on a slow host no longer decides whether the breaker opens or turns the next request away. The test that stops rproxy mid-request sets its read deadline from the stop, not from the send, so a slow wait for the app no longer shortens it. Model: opus-5-5
This commit was merged in pull request #475.
This commit is contained in:
1 parent
98d7432077
commit
aaa28f541b
5 files changed
+44
-17
No files matched your search
@@ -2,6 +2,12 @@ package rproxy
|
||||
|
||||
import "time"
|
||||
|
||||
// StopBreakerClock has the circuit breaker of s read at as the time, so that how
|
||||
// long requests take cannot matter to it. It is called before s serves.
|
||||
func (s *Server) StopBreakerClock(at time.Time) {
|
||||
s.h.breakerClock = func() time.Time { return at }
|
||||
}
|
||||
|
||||
// Breaker is the circuit breaker, for tests that give it the time.
|
||||
type Breaker struct {
|
||||
b breaker
|
||||
|
||||
Reference in new issue
Block a user