mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
fix(shared-state): count discovery failures per instance
With redis.sharedState on, every route instance added each failed discovery refresh to one fleet count. One failed round across the fleet could then open the discovery breaker. Each instance now counts its own consecutive failures. Only the instance whose own count reaches breaker.failureThreshold shares a trip, and the fleet breaker opens on the first trip.
This commit is contained in:
@@ -20,10 +20,9 @@ func (g *Gateway) wireSharedState(cfg *Config) {
|
||||
if err != nil {
|
||||
brk = breakerConfig{failureThreshold: defaultBreakerFailureThreshold, openBase: defaultBreakerOpenDuration, openMax: defaultBreakerMaxOpenDuration}
|
||||
}
|
||||
// With a shared breaker, brk.failureThreshold counts failed refreshes across all route instances and replicas
|
||||
// inside 2*openMax, not consecutive failures on one instance.
|
||||
// Each instance counts its own consecutive failures and shares only its trip, so the fleet opens on the first one.
|
||||
g.registry.shareBreaker(newSharedBreaker(g.sharedState, sharedKindDiscovery, ids,
|
||||
brk.failureThreshold, brk.openBase, brk.openMax, 2*brk.openMax))
|
||||
sharedDiscoveryFleetThreshold, brk.openBase, brk.openMax, 2*brk.openMax))
|
||||
}
|
||||
g.shareDecisionBreakers(ids)
|
||||
if g.tokenCalib != nil && g.limiter != nil {
|
||||
|
||||
Reference in New Issue
Block a user