From 29d854eae71cd726f1f0c030358d45b216e7fc59 Mon Sep 17 00:00:00 2001 From: somebodywashere <68244480+somebodywashere@users.noreply.github.com> Date: Thu, 8 Jun 2023 19:38:14 +0000 Subject: [PATCH] last fix --- web/job/check_client_ip_job.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/web/job/check_client_ip_job.go b/web/job/check_client_ip_job.go index 472e126c..67dddf43 100644 --- a/web/job/check_client_ip_job.go +++ b/web/job/check_client_ip_job.go @@ -85,6 +85,7 @@ func processLogFile() { } disAllowedIps = []string{} + shouldCleanLog := false for clientEmail, ips := range InboundClientIps { inboundClientIps, err := GetInboundClientIps(clientEmail) @@ -93,17 +94,17 @@ func processLogFile() { addInboundClientIps(clientEmail, ips) } else { - shouldCleanLog := updateInboundClientIps(inboundClientIps, clientEmail, ips) - if shouldCleanLog { - // clean log - if err := os.Truncate(GetAccessLogPath(), 0); err != nil { - checkError(err) - } - } + shouldCleanLog = updateInboundClientIps(inboundClientIps, clientEmail, ips) } } + if shouldCleanLog { + // clean log + if err := os.Truncate(GetAccessLogPath(), 0); err != nil { + checkError(err) + } + } time.Sleep(10 * time.Second) }