From 13452857c42cdf9a0df3a276a33f0f4370062b81 Mon Sep 17 00:00:00 2001 From: Adrian Najera <39295224+adriangitvitz@users.noreply.github.com> Date: Wed, 25 Oct 2023 03:07:34 -0600 Subject: [PATCH] fix: remove address cache (#1826) Co-authored-by: adriannajera --- 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 }