From a653f9495b4cf46accd0d29fe6031ab15ef20184 Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 13 Apr 2026 15:08:06 +0200 Subject: [PATCH] lock caller --- tools/remote_caller.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/remote_caller.go b/tools/remote_caller.go index 7fdb800..0f13616 100644 --- a/tools/remote_caller.go +++ b/tools/remote_caller.go @@ -8,6 +8,7 @@ import ( "net/http" "net/url" "strings" + "sync" ) // HTTP Method Enum defines the different methods that can be used to interact with the HTTP server @@ -57,7 +58,8 @@ type HTTPCallerITF interface { type HTTPCaller struct { URLS map[DataType]map[METHOD]string // Map of the different methods and their urls Disabled bool // Disabled flag - LastResults map[string]interface{} // Used to store information regarding the last execution of a given method on a given data type + Mu sync.RWMutex + LastResults map[string]interface{} // Used to store information regarding the last execution of a given method on a given data type } // NewHTTPCaller creates a new instance of the HTTP Caller @@ -217,6 +219,8 @@ func (caller *HTTPCaller) CallForm(method string, url string, subpath string, } func (caller *HTTPCaller) StoreResp(resp *http.Response) error { + caller.Mu.Lock() + defer caller.Mu.Unlock() caller.LastResults = make(map[string]interface{}) caller.LastResults["header"] = resp.Header caller.LastResults["code"] = resp.StatusCode