[#598] Hold mode mutex when setting mode
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
ad87493c41
commit
376f03a445
2 changed files with 6 additions and 0 deletions
|
@ -22,6 +22,9 @@ func (c *cache) SetMode(m mode.Mode) error {
|
|||
))
|
||||
defer span.End()
|
||||
|
||||
c.modeMtx.Lock()
|
||||
defer c.modeMtx.Unlock()
|
||||
|
||||
err := c.setMode(ctx, m)
|
||||
if err == nil {
|
||||
c.metrics.SetMode(m)
|
||||
|
|
|
@ -22,6 +22,9 @@ func (c *cache) SetMode(m mode.Mode) error {
|
|||
))
|
||||
defer span.End()
|
||||
|
||||
c.modeMtx.Lock()
|
||||
defer c.modeMtx.Unlock()
|
||||
|
||||
err := c.setMode(ctx, m)
|
||||
if err == nil {
|
||||
c.metrics.SetMode(m)
|
||||
|
|
Loading…
Reference in a new issue