rproxy: circuit breaker for asks to waf (closes #392)
check / check (push) Failing after 3m53s

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:
sneak committed 2026-11-15 14:39:56 +00:00
1 parent 8efd6339a6
commit e31935b743
11 files changed
+464 -25

No files matched your search

+11 -1
View File
@@ -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