rproxy: circuit breaker for asks to waf (closes #392)
check / check (push) Successful in 5m31s
check / check (push) Successful in 5m31s
Five asks that get no answer in time within five seconds open the breaker. While open, a request takes SWW_RPROXY_WAF_BACKEND_NO_ANSWER_DISPOSITION without asking waf, except one ask a second; the first answer closes it. Slow answers count as failures. SPEC.md describes it. The sww test that stops and restarts waf now waits for the breaker to close before it expects the ban again. Model: opus-5-5
This commit is contained in:
1 parent
8efd6339a6
commit
969383894c
10 files changed
+391
-18
No files matched your search
@@ -260,7 +260,17 @@ func TestTheSiteAnswersWhileWAFIsStoppedAndStartedAgain(t *testing.T) {
|
||||
stop()
|
||||
}()
|
||||
|
||||
wantStatus(t, site+"/", placed, http.StatusForbidden)
|
||||
// The visitor's asks have opened rproxy's circuit breaker, which lets one
|
||||
// request a second ask until one is answered.
|
||||
deadline := time.Now().Add(waitLimit)
|
||||
for statusFrom(t, site+"/", placed) != http.StatusForbidden {
|
||||
if time.Now().After(deadline) {
|
||||
t.Fatalf("request from %s: never answered %d", placed,
|
||||
http.StatusForbidden)
|
||||
}
|
||||
|
||||
time.Sleep(pollInterval)
|
||||
}
|
||||
|
||||
close(visitorStop)
|
||||
<-visitorDone
|
||||
|
||||
Reference in new issue
Block a user