From bdfb4a0b479494e1dddc2512005b7e967307efe1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 6 Apr 2022 11:47:00 +0430 Subject: [PATCH] fix : high cpu usage --- trafficcapture/service.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trafficcapture/service.go b/trafficcapture/service.go index fa011d2..dc44bf1 100644 --- a/trafficcapture/service.go +++ b/trafficcapture/service.go @@ -107,11 +107,13 @@ func (an *analyzer) reload() error { func (an *analyzer) checkCaptureHandlerError() { go func() { for { + time.Sleep(500 * time.Millisecond) select { case handlerError := <-an.errorChan: an.logger.ErrorLog("error recieve : " + handlerError.Error()) notStart := true for notStart { + time.Sleep(500 * time.Millisecond) err := an.reload() if err == nil { an.logger.Infolog("reload successfull")