From 583790e6507f22ea45779b10ade1da06a8c85b6f Mon Sep 17 00:00:00 2001 From: bergquist Date: Fri, 9 Sep 2016 07:40:35 +0200 Subject: [PATCH] fix(alering): the crocdile turned on me > < closes #5855 --- pkg/services/alerting/eval_handler.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/services/alerting/eval_handler.go b/pkg/services/alerting/eval_handler.go index 9f47252968b..ab4c377197b 100644 --- a/pkg/services/alerting/eval_handler.go +++ b/pkg/services/alerting/eval_handler.go @@ -20,7 +20,7 @@ type DefaultEvalHandler struct { func NewEvalHandler() *DefaultEvalHandler { return &DefaultEvalHandler{ log: log.New("alerting.evalHandler"), - alertJobTimeout: time.Second * 5, + alertJobTimeout: time.Second * 10, } } @@ -29,9 +29,9 @@ func (e *DefaultEvalHandler) Eval(context *EvalContext) { select { case <-time.After(e.alertJobTimeout): - context.Error = fmt.Errorf("Timeout") + context.Error = fmt.Errorf("Execution timed out after %v", e.alertJobTimeout) context.EndTime = time.Now() - e.log.Debug("Job Execution timeout", "alertId", context.Rule.Id) + e.log.Debug("Job Execution timeout", "alertId", context.Rule.Id, "timeout setting", e.alertJobTimeout) e.retry(context) case <-context.DoneChan: e.log.Debug("Job Execution done", "timeMs", context.GetDurationMs(), "alertId", context.Rule.Id, "firing", context.Firing) @@ -45,10 +45,10 @@ func (e *DefaultEvalHandler) Eval(context *EvalContext) { func (e *DefaultEvalHandler) retry(context *EvalContext) { e.log.Debug("Retrying eval exeuction", "alertId", context.Rule.Id) - context.RetryCount++ - if context.RetryCount > MaxRetries { + if context.RetryCount < MaxRetries { context.DoneChan = make(chan bool, 1) context.CancelChan = make(chan bool, 1) + context.RetryCount++ e.Eval(context) } }