From 58fe1768cc1b314732c2457cf44d85411791411a Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Wed, 13 Jul 2022 13:31:24 +0300 Subject: [PATCH] [#283] pool: Fix incErrorRate Signed-off-by: Denis Kirillov --- pool/pool.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pool/pool.go b/pool/pool.go index 90b2ead..2b98741 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -558,6 +558,10 @@ func (c *clientStatusMonitor) address() string { func (c *clientStatusMonitor) incErrorRate() { c.currentErrorCount.Inc() c.overallErrorCount.Inc() + if c.currentErrorCount.Load() >= c.errorThreshold { + c.setHealthy(false) + c.resetErrorCounter() + } } func (c *clientStatusMonitor) currentErrorRate() uint32 { @@ -601,10 +605,6 @@ func (c *clientStatusMonitor) handleError(st apistatus.Status, err error) error apistatus.WrongMagicNumber, *apistatus.WrongMagicNumber, apistatus.SignatureVerification, *apistatus.SignatureVerification: c.incErrorRate() - if c.currentErrorRate() >= c.errorThreshold { - c.setHealthy(false) - c.resetErrorCounter() - } } return err