From 71a9d4af35bd2cef64cc4740aab0753fbe0a620f Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Mon, 22 Jul 2013 11:07:53 +0200 Subject: [PATCH] Ensure minimum repeat rate for events. --- manager/aggregator.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/manager/aggregator.go b/manager/aggregator.go index c7b965c9..139dee8b 100644 --- a/manager/aggregator.go +++ b/manager/aggregator.go @@ -20,6 +20,7 @@ import ( ) const ( + minimumRepeatRate = 5 * time.Minute minimumRefreshPeriod = 5 * time.Minute notificationRetryPeriod = 1 * time.Minute ) @@ -213,6 +214,13 @@ type aggregatorResetRulesRequest struct { func (a *Aggregator) replaceRules(r *aggregatorResetRulesRequest) { log.Println("Replacing", len(r.Rules), "aggregator rules...") + + for _, rule := range r.Rules { + if rule.RepeatRate < minimumRepeatRate { + log.Println("Rule repeat rate too low, setting to minimum value") + rule.RepeatRate = minimumRepeatRate + } + } a.Rules = r.Rules r.Response <- new(aggregatorResetRulesResponse)