mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-08-10 13:20:33 +02: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
|
return nil
|
||||||
}
|
}
|
||||||
// if we have an answer, we should reset the failure count
|
// 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 {
|
if answer != nil {
|
||||||
p.um.mu.Lock()
|
p.um.mu.Lock()
|
||||||
p.um.failureReq[upstreams[n]] = 0
|
p.um.failureReq[upstreams[n]] = 0
|
||||||
|
p.um.down[upstreams[n]] = false
|
||||||
p.um.mu.Unlock()
|
p.um.mu.Unlock()
|
||||||
}
|
}
|
||||||
return answer
|
return answer
|
||||||
|
|||||||
@@ -85,8 +85,6 @@ func (um *upstreamMonitor) increaseFailureCount(upstream string) {
|
|||||||
if failedCount >= maxFailureRequest {
|
if failedCount >= maxFailureRequest {
|
||||||
um.down[upstream] = true
|
um.down[upstream] = true
|
||||||
mainLog.Load().Warn().Msgf("upstream %q marked as down immediately (failure count: %d)", upstream, failedCount)
|
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