mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-12 05:32:36 +00:00
fix(tests): configurable retry delays and circuit backoff overflow
Three bugs fixed: 1. Test suite timeout: add Client.RetryBaseDelayMs/RetryMaxDelayMs config fields (env CLIENT_RETRY_BASE_DELAY_MS/CLIENT_RETRY_MAX_DELAY_MS, defaults 500ms/10s). Tests override to 10ms so retry exhaustion completes in ms instead of ~25s per request. Suite runs in ~35s. 2. effectiveCircuitBackoff float overflow: on amd64, float64(+Inf) cast to int64 gives MinInt64 not MaxInt64, so the < base guard fired and returned base instead of the 24h sanity ceiling. Fix: check math.IsInf/math.IsNaN before the cast. 3. TestStartHTTPProxy_ErrorHandlerConfigured bypassed the TestSuite retry-delay override; now sets/restores the fields explicitly. Co-authored-by: lukaszraczylo <[email protected]>
This commit is contained in:
co-authored by
lukaszraczylo
parent
8d1518b961
commit
99f0c844f0
@@ -958,14 +958,12 @@ func performProxyRequestWithEnhancedRetries(c fiber.Ctx, proxyURL string, backen
|
||||
}
|
||||
|
||||
if backendUnhealthy {
|
||||
// Backend is known to be unhealthy, fail fast
|
||||
// Circuit breaker should handle this, so reduce retries
|
||||
// Backend is known to be unhealthy; fail fast with fewer attempts.
|
||||
// The circuit breaker should handle it, so the max delay matches
|
||||
// the normal path (avoids invisible behaviour differences).
|
||||
attempts = 3
|
||||
initialDelay = time.Duration(baseDelayMs) * time.Millisecond
|
||||
maxDelayTime = time.Duration(maxDelayMs/2) * time.Millisecond
|
||||
if maxDelayTime < initialDelay {
|
||||
maxDelayTime = initialDelay
|
||||
}
|
||||
maxDelayTime = time.Duration(maxDelayMs) * time.Millisecond
|
||||
} else {
|
||||
// Normal retry strategy
|
||||
attempts = 7
|
||||
|
||||
Reference in New Issue
Block a user