mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 21:24:05 -08:00
Fix race condition in Rule manager.Update() function
Signed-off-by: fuling <fuling.lgz@alibaba-inc.com>
This commit is contained in:
parent
3fff701b77
commit
8b11d2cfb6
|
@ -921,7 +921,7 @@ func (m *Manager) Update(interval time.Duration, files []string, externalLabels
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(newg *Group) {
|
go func(newg *Group, oldg *Group) {
|
||||||
if ok {
|
if ok {
|
||||||
oldg.stop()
|
oldg.stop()
|
||||||
newg.CopyState(oldg)
|
newg.CopyState(oldg)
|
||||||
|
@ -934,7 +934,7 @@ func (m *Manager) Update(interval time.Duration, files []string, externalLabels
|
||||||
newg.run(m.opts.Context)
|
newg.run(m.opts.Context)
|
||||||
}()
|
}()
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}(newg)
|
}(newg, oldg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop remaining old groups.
|
// Stop remaining old groups.
|
||||||
|
|
Loading…
Reference in a new issue