From 7be21ebc38e0b47930ebd99722124dcfdda644e1 Mon Sep 17 00:00:00 2001
From: msherif1234 <mmahmoud@redhat.com>
Date: Tue, 25 Apr 2023 13:34:43 -0400
Subject: [PATCH] NETOBSERV-753: Reset ticker if flows flushed when
 cacheMaxFlows is reached

Signed-off-by: msherif1234 <mmahmoud@redhat.com>
---
 pkg/flow/account.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pkg/flow/account.go b/pkg/flow/account.go
index bca28dd4..f1eca970 100644
--- a/pkg/flow/account.go
+++ b/pkg/flow/account.go
@@ -74,6 +74,9 @@ func (c *Accounter) Account(in <-chan *RawRecord, out chan<- []*Record) {
 					logrus.WithField("flows", len(evictingEntries)).
 						Debug("evicting flows from userspace accounter after reaching cache max length")
 					c.evict(evictingEntries, out)
+					// Since we will evict flows because we reached to cacheMaxFlows then reset
+					// evictTimer to avoid unnecessary another eviction when timer expires.
+					evictTick.Reset(c.evictTimeout)
 				}
 				c.entries[record.Id] = &record.Metrics
 			}
-- 
GitLab