mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
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:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user