From f1aa1d26abf34ce5f1a278ce65d8dcdfb1bbda3b Mon Sep 17 00:00:00 2001 From: adriannajera Date: Thu, 19 Oct 2023 15:33:04 -0600 Subject: [PATCH] FIX: Remove address cache --- api/client-admin.go | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/api/client-admin.go b/api/client-admin.go index 4858b7681f6..cefaaf4951f 100644 --- a/api/client-admin.go +++ b/api/client-admin.go @@ -24,7 +24,6 @@ import ( "net" "net/http" "net/url" - "sync" "time" "github.com/minio/madmin-go/v2" @@ -464,15 +463,6 @@ func (ac AdminClient) verifyTierStatus(ctx context.Context, tierName string) err return ac.Client.VerifyTier(ctx, tierName) } -// httpClient is a custom http client, this client should not be called directly and instead be -// called using GetConsoleHTTPClient() to ensure is initialized and the certificates are loaded correctly -var httpClients = struct { - sync.Mutex - m map[string]*http.Client -}{ - m: make(map[string]*http.Client), -} - // isLocalAddress returns true if the url contains an IPv4/IPv6 hostname // that points to the local machine - FQDN are not supported func isLocalIPAddress(ipAddr string) bool { @@ -492,17 +482,8 @@ func GetConsoleHTTPClient(address string) *http.Client { address = u.Hostname() } - httpClients.Lock() - client, ok := httpClients.m[address] - httpClients.Unlock() - if ok { - return client - } + client := PrepareConsoleHTTPClient(isLocalIPAddress(address)) - client = PrepareConsoleHTTPClient(isLocalIPAddress(address)) - httpClients.Lock() - httpClients.m[address] = client - httpClients.Unlock() return client }