Commit 516a3259 authored by Felipe Andrade's avatar Felipe Andrade

feat(proxyd): prevent banning out-of-sync backend

parent c0e63f28
...@@ -215,25 +215,24 @@ func (cp *ConsensusPoller) UpdateBackend(ctx context.Context, be *Backend) { ...@@ -215,25 +215,24 @@ func (cp *ConsensusPoller) UpdateBackend(ctx context.Context, be *Backend) {
RecordConsensusBackendBanned(be, banned) RecordConsensusBackendBanned(be, banned)
if banned { if banned {
log.Debug("skipping backend banned", "backend", be.Name) log.Debug("skipping backend - banned", "backend", be.Name)
return
}
// if backend it not online or not in a health state we'll only resume checkin it after ban
if !be.Online() || !be.IsHealthy() {
log.Warn("backend banned - not online or not healthy", "backend", be.Name)
cp.Ban(be)
return return
} }
// if backend it not in sync we'll check again after ban // if backend it not in sync we'll check again after ban
inSync, err := cp.isInSync(ctx, be) inSync, err := cp.isInSync(ctx, be)
RecordConsensusBackendInSync(be, err == nil && inSync)
if err != nil || !inSync { if err != nil || !inSync {
log.Warn("backend banned - not in sync", "backend", be.Name) log.Warn("skipping backend - not in sync", "backend", be.Name)
return
}
// if backend it not online or not in a health state we'll only resume checkin it after ban
if !be.Online() || !be.IsHealthy() {
log.Warn("backend banned - not online or not healthy", "backend", be.Name)
cp.Ban(be) cp.Ban(be)
return return
} }
RecordConsensusBackendInSync(be, inSync)
// if backend exhausted rate limit we'll skip it for now // if backend exhausted rate limit we'll skip it for now
if be.IsRateLimited() { if be.IsRateLimited() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment