don't try to send/don't notify if plugin chan is nil (#923)
This commit is contained in:
parent
b5d0d56a11
commit
68c11dd827
|
@ -98,12 +98,14 @@ func FormatAlerts(result []*ent.Alert) models.AddAlertsRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) sendAlertToPluginChannel(alert *models.Alert, profileID uint) {
|
func (c *Controller) sendAlertToPluginChannel(alert *models.Alert, profileID uint) {
|
||||||
|
if c.PluginChannel != nil {
|
||||||
select {
|
select {
|
||||||
case c.PluginChannel <- csplugin.ProfileAlert{ProfileID: uint(profileID), Alert: alert}:
|
case c.PluginChannel <- csplugin.ProfileAlert{ProfileID: uint(profileID), Alert: alert}:
|
||||||
log.Debugf("alert sent to Plugin channel")
|
log.Debugf("alert sent to Plugin channel")
|
||||||
default:
|
default:
|
||||||
log.Warningf("Cannot send alert to Plugin channel")
|
log.Warningf("Cannot send alert to Plugin channel")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateAlert : write received alerts in body to the database
|
// CreateAlert : write received alerts in body to the database
|
||||||
|
|
Loading…
Reference in a new issue