Adding logic to prevent ”non-positive interval for newticker” (WIP) (#10532)

* Adding logic to prevent `”non-positive interval for newticker”`

* Update vault/quotas/quotas_rate_limit.go

---------

Co-authored-by: Violet Hynes <a.xenasis@gmail.com>
Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
This commit is contained in:
Peter Souter
2023-08-14 20:38:20 +01:00
committed by GitHub
parent d5b29f697a
commit b2249b07e2

View File

@@ -219,6 +219,9 @@ func (rlq *RateLimitQuota) initialize(logger log.Logger, ms *metricsutil.Cluster
// in which we stop the ticker and return.
func (rlq *RateLimitQuota) purgeBlockedClients() {
rlq.lock.RLock()
if rlq.purgeInterval <= 0 {
rlq.purgeInterval = DefaultRateLimitPurgeInterval
}
ticker := time.NewTicker(rlq.purgeInterval)
rlq.lock.RUnlock()