fix concurrent read and wirte group error (#1447)
* fix concurrent read and wirte group Signed-off-by: denghuan <denghuan@actionsky.com> * make lock more elegant Signed-off-by: denghuan <denghuan@actionsky.com>
This commit is contained in:
parent
5aac7c840b
commit
f3bc41d256
|
@ -260,12 +260,13 @@ func (d *Dispatcher) processAlert(alert *types.Alert, route *Route) {
|
|||
fp := groupLabels.Fingerprint()
|
||||
|
||||
d.mtx.Lock()
|
||||
defer d.mtx.Unlock()
|
||||
|
||||
group, ok := d.aggrGroups[route]
|
||||
if !ok {
|
||||
group = map[model.Fingerprint]*aggrGroup{}
|
||||
d.aggrGroups[route] = group
|
||||
}
|
||||
d.mtx.Unlock()
|
||||
|
||||
// If the group does not exist, create it.
|
||||
ag, ok := group[fp]
|
||||
|
|
Loading…
Reference in New Issue