mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
fix down state handling
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user