From 9a3c9e4d61b25f9c11a2e4588933f36591c99c4e Mon Sep 17 00:00:00 2001 From: TwinProduction Date: Sat, 22 Aug 2020 14:15:08 -0400 Subject: [PATCH] Set default alert threshold to 3 --- core/service.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/service.go b/core/service.go index 18b684e5..6643e5eb 100644 --- a/core/service.go +++ b/core/service.go @@ -42,6 +42,11 @@ func (service *Service) Validate() { if len(service.Headers) == 0 { service.Headers = make(map[string]string) } + for _, alert := range service.Alerts { + if alert.Threshold <= 0 { + alert.Threshold = 3 + } + } if len(service.Url) == 0 { panic(ErrNoUrl) } @@ -73,6 +78,7 @@ func (service *Service) EvaluateConditions() *Result { result.Timestamp = time.Now() if result.Success { service.numberOfFailuresInARow = 0 + // TODO: Send notification that alert has been resolved? } else { service.numberOfFailuresInARow++ }