fix down state handling

This commit is contained in:
Alex
2025-02-10 18:39:45 -05:00
committed by Cuong Manh Le
parent e3b99bf339
commit 41a00c68ac
2 changed files with 2 additions and 2 deletions

View File

@@ -545,9 +545,11 @@ func (p *prog) proxy(ctx context.Context, req *proxyRequest) *proxyResponse {
return nil
}
// if we have an answer, we should reset the failure count
// we dont use reset here since we dont want to prevent failure counts from being incremented
if answer != nil {
p.um.mu.Lock()
p.um.failureReq[upstreams[n]] = 0
p.um.down[upstreams[n]] = false
p.um.mu.Unlock()
}
return answer

View File

@@ -85,8 +85,6 @@ func (um *upstreamMonitor) increaseFailureCount(upstream string) {
if failedCount >= maxFailureRequest {
um.down[upstream] = true
mainLog.Load().Warn().Msgf("upstream %q marked as down immediately (failure count: %d)", upstream, failedCount)
} else {
um.down[upstream] = false
}
}