[#283] pool: Fix incErrorRate

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-07-13 13:31:24 +03:00 committed by fyrchik
parent 0b8c53ebc9
commit 58fe1768cc

View file

@ -558,6 +558,10 @@ func (c *clientStatusMonitor) address() string {
func (c *clientStatusMonitor) incErrorRate() { func (c *clientStatusMonitor) incErrorRate() {
c.currentErrorCount.Inc() c.currentErrorCount.Inc()
c.overallErrorCount.Inc() c.overallErrorCount.Inc()
if c.currentErrorCount.Load() >= c.errorThreshold {
c.setHealthy(false)
c.resetErrorCounter()
}
} }
func (c *clientStatusMonitor) currentErrorRate() uint32 { func (c *clientStatusMonitor) currentErrorRate() uint32 {
@ -601,10 +605,6 @@ func (c *clientStatusMonitor) handleError(st apistatus.Status, err error) error
apistatus.WrongMagicNumber, *apistatus.WrongMagicNumber, apistatus.WrongMagicNumber, *apistatus.WrongMagicNumber,
apistatus.SignatureVerification, *apistatus.SignatureVerification: apistatus.SignatureVerification, *apistatus.SignatureVerification:
c.incErrorRate() c.incErrorRate()
if c.currentErrorRate() >= c.errorThreshold {
c.setHealthy(false)
c.resetErrorCounter()
}
} }
return err return err