From 7ab3a129ab8f41cf922302602ed452c17158fb96 Mon Sep 17 00:00:00 2001 From: Jim Colderwood Date: Fri, 14 Jul 2023 21:31:32 +0100 Subject: [PATCH] last_access time dup --- main.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.go b/main.go index 86e4c95..02b843e 100644 --- a/main.go +++ b/main.go @@ -123,11 +123,11 @@ func req(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "application/json") monitor.Mu.Lock() + monitor.Last_access = time.Now() monitor.Stats.Hits++ /* Wait for new data */ if monitor.Cache_stale { - monitor.Last_access = time.Now() for { monitor.Mu.Unlock() time.Sleep(time.Millisecond * 10) @@ -138,7 +138,6 @@ func req(w http.ResponseWriter, r *http.Request) { } } - monitor.Last_access = time.Now() json.NewEncoder(w).Encode(monitor.Calls) monitor.Mu.Unlock() }