mirror of
https://github.com/TwiN/gatus.git
synced 2024-12-14 11:58:04 +00:00
fix(alerting): Make sure alert is triggered before attempting to persist it to the database
Related to #764 and #679
This commit is contained in:
parent
f2c5f5911c
commit
2a94f76244
1 changed files with 1 additions and 1 deletions
|
@ -65,7 +65,7 @@ func handleAlertsToResolve(ep *endpoint.Endpoint, result *endpoint.Result, alert
|
||||||
ep.NumberOfSuccessesInARow++
|
ep.NumberOfSuccessesInARow++
|
||||||
for _, endpointAlert := range ep.Alerts {
|
for _, endpointAlert := range ep.Alerts {
|
||||||
isStillBelowSuccessThreshold := endpointAlert.SuccessThreshold > ep.NumberOfSuccessesInARow
|
isStillBelowSuccessThreshold := endpointAlert.SuccessThreshold > ep.NumberOfSuccessesInARow
|
||||||
if isStillBelowSuccessThreshold && endpointAlert.IsEnabled() {
|
if isStillBelowSuccessThreshold && endpointAlert.IsEnabled() && endpointAlert.Triggered {
|
||||||
// Persist NumberOfSuccessesInARow
|
// Persist NumberOfSuccessesInARow
|
||||||
if err := store.Get().UpsertTriggeredEndpointAlert(ep, endpointAlert); err != nil {
|
if err := store.Get().UpsertTriggeredEndpointAlert(ep, endpointAlert); err != nil {
|
||||||
log.Printf("[watchdog.handleAlertsToResolve] Failed to update triggered endpoint alert for endpoint with key=%s: %s", ep.Key(), err.Error())
|
log.Printf("[watchdog.handleAlertsToResolve] Failed to update triggered endpoint alert for endpoint with key=%s: %s", ep.Key(), err.Error())
|
||||||
|
|
Loading…
Reference in a new issue