alerting: return err when SetAlertState fails to save to sql (#18216)

fix duplicate alert states when the alert fails to save to the database.
fixes #18176
This commit is contained in:
Kyle Brandt 2019-07-22 07:23:27 -04:00 committed by GitHub
parent 2014549fa5
commit 172464e91e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -298,7 +298,10 @@ func SetAlertState(cmd *m.SetAlertStateCommand) error {
alert.ExecutionError = cmd.Error
}
sess.ID(alert.Id).Update(&alert)
_, err := sess.ID(alert.Id).Update(&alert)
if err != nil {
return err
}
cmd.Result = alert
return nil