Compare commits
2 commits
master
...
notificati
Author | SHA1 | Date | |
---|---|---|---|
|
5e8081e76c | ||
|
1aa6f4014f |
1 changed files with 13 additions and 2 deletions
|
@ -115,9 +115,20 @@ loop:
|
||||||
pb.alertsByPluginName[pluginName] = make([]*models.Alert, 0)
|
pb.alertsByPluginName[pluginName] = make([]*models.Alert, 0)
|
||||||
pluginMutex.Unlock()
|
pluginMutex.Unlock()
|
||||||
go func() {
|
go func() {
|
||||||
if err := pb.pushNotificationsToPlugin(pluginName, tmpAlerts); err != nil {
|
//Chunk alerts to respect group_threshold
|
||||||
|
threshold := pb.pluginConfigByName[pluginName].GroupThreshold
|
||||||
|
if threshold == 0 {
|
||||||
|
threshold = 1
|
||||||
|
}
|
||||||
|
for i := 0; i < len(tmpAlerts); i += threshold {
|
||||||
|
end := i + threshold
|
||||||
|
if end > len(tmpAlerts) {
|
||||||
|
end = len(tmpAlerts)
|
||||||
|
}
|
||||||
|
if err := pb.pushNotificationsToPlugin(pluginName, tmpAlerts[i:end]); err != nil {
|
||||||
log.WithField("plugin:", pluginName).Error(err)
|
log.WithField("plugin:", pluginName).Error(err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
case <-pluginTomb.Dying():
|
case <-pluginTomb.Dying():
|
||||||
|
|
Loading…
Reference in a new issue