Minor changes to specific logs (#900)

- Minor changes to specific logs
- Fix LAPI to not push signals to CAPI when disabled #907
This commit is contained in:
ThinkChaos 2021-08-25 12:30:05 -04:00 committed by GitHub
parent 488f28e3a3
commit 448a227079
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 29 additions and 23 deletions

View file

@ -166,12 +166,16 @@ func (c *Controller) CreateAlert(gctx *gin.Context) {
for _, alert := range input {
alert.MachineID = machineID
}
select {
case c.CAPIChan <- input:
log.Debugf("alert sent to CAPI channel")
default:
log.Warningf("Cannot send alert to Central API channel")
if c.CAPIChan != nil {
select {
case c.CAPIChan <- input:
log.Debug("alert sent to CAPI channel")
default:
log.Warning("Cannot send alert to Central API channel")
}
}
gctx.JSON(http.StatusCreated, alerts)
return
}