mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-05 12:26:34 +02:00
Attempt to grab read statelock in emit metrics to remove some raciness (#6829)
This commit is contained in:
parent
f5baee5b55
commit
b4cc1413f2
@ -1663,6 +1663,11 @@ func (c *Core) emitMetrics(stopCh chan struct{}) {
|
||||
c.metricsMutex.Unlock()
|
||||
|
||||
case <-writeTimer:
|
||||
if stopped := grabLockOrStop(c.stateLock.RLock, c.stateLock.RUnlock, stopCh); stopped {
|
||||
// Go through the loop again, this time the stop channel case
|
||||
// should trigger
|
||||
continue
|
||||
}
|
||||
if c.perfStandby {
|
||||
syncCounter(c)
|
||||
} else {
|
||||
@ -1671,6 +1676,7 @@ func (c *Core) emitMetrics(stopCh chan struct{}) {
|
||||
c.logger.Error("writing request counters to barrier", "err", err)
|
||||
}
|
||||
}
|
||||
c.stateLock.RUnlock()
|
||||
|
||||
case <-stopCh:
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user