From 04048e5ad481106d4992fa8c60d046d4eeb64582 Mon Sep 17 00:00:00 2001 From: peusebiu Date: Thu, 12 Oct 2023 11:00:33 +0300 Subject: [PATCH] fix(sync): fix data race when pinging registries by read-locking (#1924) Signed-off-by: Petu Eusebiu --- pkg/extensions/sync/httpclient/client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/extensions/sync/httpclient/client.go b/pkg/extensions/sync/httpclient/client.go index ddd239c15..b78503d8b 100644 --- a/pkg/extensions/sync/httpclient/client.go +++ b/pkg/extensions/sync/httpclient/client.go @@ -73,6 +73,9 @@ func (httpClient *Client) SetConfig(config Config) error { } func (httpClient *Client) Ping() bool { + httpClient.lock.RLock() + defer httpClient.lock.RUnlock() + pingURL := *httpClient.url pingURL = *pingURL.JoinPath("/v2/")