feat(proxyd): prevent banning out-of-sync backend
This commit is contained in:
parent
21284bd651
commit
8e45b5d5ca
@ -215,7 +215,15 @@ 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 in sync we'll check again after ban
|
||||||
|
inSync, err := cp.isInSync(ctx, be)
|
||||||
|
RecordConsensusBackendInSync(be, err == nil && inSync)
|
||||||
|
if err != nil || !inSync {
|
||||||
|
log.Warn("skipping backend - not in sync", "backend", be.Name)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,15 +234,6 @@ func (cp *ConsensusPoller) UpdateBackend(ctx context.Context, be *Backend) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// if backend it not in sync we'll check again after ban
|
|
||||||
inSync, err := cp.isInSync(ctx, be)
|
|
||||||
if err != nil || !inSync {
|
|
||||||
log.Warn("backend banned - not in sync", "backend", be.Name)
|
|
||||||
cp.Ban(be)
|
|
||||||
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() {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user