From 0a741e0bbc473957668fa70da5a6d3420432c60b Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Tue, 20 Jul 2021 09:00:28 +0300 Subject: [PATCH] Refactor processEvent function from thresholds.go --- engine/thresholds.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/engine/thresholds.go b/engine/thresholds.go index 7d9e6d6e9..bd0db22db 100644 --- a/engine/thresholds.go +++ b/engine/thresholds.go @@ -323,9 +323,9 @@ func (tS *ThresholdService) processEvent(ctx *context.Context, tnt string, args return nil, err } var withErrors bool - var tIDs []string + thresholdsIDs = make([]string, 0, len(matchTS)) for _, t := range matchTS { - tIDs = append(tIDs, t.ID) + thresholdsIDs = append(thresholdsIDs, t.ID) t.Hits++ if err = processEventWithThreshold(ctx, tS.connMgr, tS.cgrcfg.ThresholdSCfg().ActionSConns, args.CGREvent, t); err != nil { @@ -362,10 +362,6 @@ func (tS *ThresholdService) processEvent(ctx *context.Context, tnt string, args tS.stMux.Unlock() } } - if len(tIDs) == 0 { - return nil, utils.ErrNotFound - } - thresholdsIDs = append(thresholdsIDs, tIDs...) if withErrors { err = utils.ErrPartiallyExecuted }