feat(failover): share the request breaker through Redis

The request breaker now also reads and writes the fleet breaker when redis.sharedState is on. A pod that sees enough failures opens the breaker for every pod after one refresh. A success on any pod closes it again. With the switch off, the tracker runs its local code only and makes no store call.
This commit is contained in:
2026-11-26 03:26:39 +00:00
parent 807cc6ee75
commit a46058694b
6 changed files with 187 additions and 7 deletions
+22
View File
@@ -737,3 +737,25 @@ func TestSharedStateNoIdleStopWithPendingDeltas(t *testing.T) {
}
l.close()
}
func TestSharedBreakerSuccessClosesOpen(t *testing.T) {
store, clk := sharedTestEnv()
la, lb, lc := sharedTestLoop(store, clk), sharedTestLoop(store, clk), sharedTestLoop(store, clk)
a, b, c := testBreaker(la), testBreaker(lb), testBreaker(lc)
for i := 0; i < 3; i++ {
a.recordFailure("p")
}
la.refresh()
lb.refresh()
if !b.sharedOpen("p") {
t.Fatal("B shared view closed after the trip")
}
b.recordSuccess("p")
lc.refresh()
if c.sharedOpen("p") {
t.Fatal("C still sees open after B's success")
}
if b.sharedOpen("p") {
t.Fatal("B still sees open right after its own success")
}
}