From 58c242b7a09cd559401fcbfb0d06f9e81c8ce9fb Mon Sep 17 00:00:00 2001 From: nabil salah Date: Wed, 18 Dec 2024 14:08:06 +0200 Subject: [PATCH 1/5] feat: use of retryable http server Signed-off-by: nabil salah --- go.mod | 3 +++ go.sum | 4 ++++ pkg/environment/config.go | 9 +++++---- pkg/flist/flist.go | 22 ++++++++++++---------- pkg/gateway/metrics.go | 13 +++++++------ pkg/perf/publicip/publicip_task.go | 14 ++++++++------ pkg/provision/engine.go | 11 +++++++---- pkg/upgrade/hub/hub.go | 10 ++++++---- pkg/vm/client.go | 26 ++++++++++++++------------ 9 files changed, 66 insertions(+), 46 deletions(-) diff --git a/go.mod b/go.mod index d2374b078..2b9d1ce58 100644 --- a/go.mod +++ b/go.mod @@ -62,6 +62,8 @@ require ( gotest.tools v2.2.0+incompatible ) +require github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + require ( github.com/Microsoft/go-winio v0.5.2 // indirect github.com/Microsoft/hcsshim v0.8.25 // indirect @@ -94,6 +96,7 @@ require ( github.com/hanwen/go-fuse/v2 v2.3.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-retryablehttp v0.7.7 github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/holiman/uint256 v1.2.3 // indirect github.com/jarcoal/httpmock v1.3.1 diff --git a/go.sum b/go.sum index 4901c22a2..09c63c35a 100644 --- a/go.sum +++ b/go.sum @@ -287,8 +287,12 @@ github.com/hanwen/go-fuse/v2 v2.3.0/go.mod h1:xKwi1cF7nXAOBCXujD5ie0ZKsxc8GGSA1r github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= +github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= diff --git a/pkg/environment/config.go b/pkg/environment/config.go index 98d60e6e0..efa5640b1 100644 --- a/pkg/environment/config.go +++ b/pkg/environment/config.go @@ -9,6 +9,7 @@ import ( "strings" "time" + "github.com/hashicorp/go-retryablehttp" "github.com/pkg/errors" ) @@ -51,9 +52,9 @@ func GetConfig() (base Config, err error) { // GetConfig returns extend config for specific run mode func GetConfigForMode(mode RunMode) (Config, error) { - httpClient := &http.Client{ - Timeout: defaultHttpTimeout, - } + httpClient := retryablehttp.NewClient() + httpClient.HTTPClient.Timeout = defaultHttpTimeout + httpClient.RetryMax = 3 return getConfig(mode, baseExtendedURL, httpClient) } @@ -70,7 +71,7 @@ func uniqueStr(slice []string) []string { return list } -func getConfig(run RunMode, url string, httpClient *http.Client) (ext Config, err error) { +func getConfig(run RunMode, url string, httpClient *retryablehttp.Client) (ext Config, err error) { if !strings.HasSuffix(url, "/") { url += "/" } diff --git a/pkg/flist/flist.go b/pkg/flist/flist.go index f99b10ece..fb47c87a7 100644 --- a/pkg/flist/flist.go +++ b/pkg/flist/flist.go @@ -18,6 +18,7 @@ import ( "time" "github.com/containernetworking/plugins/pkg/ns" + "github.com/hashicorp/go-retryablehttp" "github.com/pkg/errors" "github.com/rs/zerolog/log" "github.com/threefoldtech/zos/pkg" @@ -126,7 +127,7 @@ type flistModule struct { commander commander system system - httpClient *http.Client + httpClient *retryablehttp.Client } func newFlister(root string, storage volumeAllocator, commander commander, system system) *flistModule { @@ -155,6 +156,9 @@ func newFlister(root string, storage volumeAllocator, commander commander, syste } } + httpClient := retryablehttp.NewClient() + httpClient.HTTPClient.Timeout = defaultHubCallTimeout + httpClient.RetryMax = 3 return &flistModule{ root: root, flist: filepath.Join(root, "flist"), @@ -168,9 +172,7 @@ func newFlister(root string, storage volumeAllocator, commander commander, syste commander: commander, system: system, - httpClient: &http.Client{ - Timeout: defaultHubCallTimeout, - }, + httpClient: httpClient, } } @@ -731,14 +733,14 @@ func (f *flistModule) downloadInNamespace(name, u string) (resp *http.Response, return errors.Wrap(err, "failed to start tcp connection") } - cl := http.Client{ - Transport: &http.Transport{ - DisableKeepAlives: true, - DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { - return con, nil - }, + cl := retryablehttp.NewClient() + cl.HTTPClient.Transport = &http.Transport{ + DisableKeepAlives: true, + DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { + return con, nil }, } + cl.RetryMax = 3 resp, err = cl.Get(u) return err diff --git a/pkg/gateway/metrics.go b/pkg/gateway/metrics.go index 95ba251bb..f7d80785f 100644 --- a/pkg/gateway/metrics.go +++ b/pkg/gateway/metrics.go @@ -12,6 +12,7 @@ import ( "strings" "github.com/containernetworking/plugins/pkg/ns" + "github.com/hashicorp/go-retryablehttp" "github.com/pkg/errors" "github.com/rs/zerolog/log" "github.com/threefoldtech/zos/pkg" @@ -139,14 +140,14 @@ func metrics(rawUrl string) (map[string]*metric, error) { defer con.Close() - cl := http.Client{ - Transport: &http.Transport{ - DisableKeepAlives: true, - DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { - return con, nil - }, + cl := retryablehttp.NewClient() + cl.HTTPClient.Transport = &http.Transport{ + DisableKeepAlives: true, + DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { + return con, nil }, } + cl.RetryMax = 5 response, err := cl.Get(rawUrl) diff --git a/pkg/perf/publicip/publicip_task.go b/pkg/perf/publicip/publicip_task.go index 02f98426b..ca5c0024f 100644 --- a/pkg/perf/publicip/publicip_task.go +++ b/pkg/perf/publicip/publicip_task.go @@ -12,6 +12,7 @@ import ( "github.com/cenkalti/backoff/v3" "github.com/containernetworking/plugins/pkg/ns" + "github.com/hashicorp/go-retryablehttp" "github.com/rs/zerolog/log" substrate "github.com/threefoldtech/tfchain/clients/tfchain-client-go" "github.com/threefoldtech/zos/pkg/environment" @@ -271,14 +272,15 @@ func getRealPublicIP() (net.IP, error) { defer con.Close() - cl := http.Client{ - Transport: &http.Transport{ - DisableKeepAlives: true, - DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { - return con, nil - }, + cl := retryablehttp.NewClient() + cl.HTTPClient.Transport = &http.Transport{ + DisableKeepAlives: true, + DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { + return con, nil }, } + cl.RetryMax = 5 + response, err := cl.Get("https://api.ipify.org/") if err != nil { return nil, errors.Join(err, errPublicIPLookup) diff --git a/pkg/provision/engine.go b/pkg/provision/engine.go index 9842b5307..3254376a4 100644 --- a/pkg/provision/engine.go +++ b/pkg/provision/engine.go @@ -13,6 +13,7 @@ import ( "time" "github.com/cenkalti/backoff/v3" + "github.com/hashicorp/go-retryablehttp" "github.com/joncrlsn/dque" "github.com/pkg/errors" "github.com/rs/zerolog/log" @@ -91,6 +92,8 @@ const ( opPause // opResume resumes a deployment opResume + // servers default timeout + defaultHttpTimeout = 10 * time.Second ) // engineJob is a persisted job instance that is @@ -1210,11 +1213,11 @@ func isTwinVerified(twinID uint32) (verified bool, err error) { q.Set("twin_id", fmt.Sprint(twinID)) request.URL.RawQuery = q.Encode() - cl := &http.Client{ - Timeout: 10 * time.Second, - } + cl := retryablehttp.NewClient() + cl.HTTPClient.Timeout = defaultHttpTimeout + cl.RetryMax = 3 - response, err := cl.Do(request) + response, err := cl.Do(&retryablehttp.Request{Request: request}) if err != nil { return } diff --git a/pkg/upgrade/hub/hub.go b/pkg/upgrade/hub/hub.go index c57d156e8..b6b469642 100644 --- a/pkg/upgrade/hub/hub.go +++ b/pkg/upgrade/hub/hub.go @@ -11,6 +11,7 @@ import ( "strings" "time" + "github.com/hashicorp/go-retryablehttp" "github.com/pkg/errors" "github.com/rs/zerolog/log" "github.com/threefoldtech/0-fs/meta" @@ -65,15 +66,16 @@ func MatchType(typ FListType) FListFilter { // HubClient API for f-list type HubClient struct { - httpClient *http.Client + httpClient *retryablehttp.Client } // NewHubClient create new hub client with the passed option for the http client func NewHubClient(timeout time.Duration) *HubClient { + httpClient := retryablehttp.NewClient() + httpClient.RetryMax = 5 + httpClient.HTTPClient.Timeout = timeout return &HubClient{ - httpClient: &http.Client{ - Timeout: timeout, - }, + httpClient: httpClient, } } diff --git a/pkg/vm/client.go b/pkg/vm/client.go index aa142102b..bc9552325 100644 --- a/pkg/vm/client.go +++ b/pkg/vm/client.go @@ -8,12 +8,13 @@ import ( "net" "net/http" + "github.com/hashicorp/go-retryablehttp" "github.com/pkg/errors" ) // Client to a cloud hypervisor instance type Client struct { - client http.Client + client *retryablehttp.Client } type VMData struct { @@ -24,15 +25,16 @@ type VMData struct { // NewClient creates a new instance of client func NewClient(unix string) *Client { - client := Client{ - client: http.Client{ - Transport: &http.Transport{ - Dial: func(network, _ string) (net.Conn, error) { - return net.Dial("unix", unix) - }, - }, + httpClient := retryablehttp.NewClient() + httpClient.RetryMax = 5 + httpClient.HTTPClient.Transport = &http.Transport{ + Dial: func(network, _ string) (net.Conn, error) { + return net.Dial("unix", unix) }, } + client := Client{ + client: httpClient, + } return &client } @@ -43,7 +45,7 @@ func (c *Client) Shutdown(ctx context.Context) error { if err != nil { return err } - response, err := c.client.Do(request) + response, err := c.client.Do(&retryablehttp.Request{Request: request}) if err != nil { return errors.Wrap(err, "error calling machine shutdown") } @@ -61,7 +63,7 @@ func (c *Client) Pause(ctx context.Context) error { if err != nil { return err } - response, err := c.client.Do(request) + response, err := c.client.Do(&retryablehttp.Request{Request: request}) if err != nil { return errors.Wrap(err, "error calling machine pause") } @@ -79,7 +81,7 @@ func (c *Client) Resume(ctx context.Context) error { if err != nil { return err } - response, err := c.client.Do(request) + response, err := c.client.Do(&retryablehttp.Request{Request: request}) if err != nil { return errors.Wrap(err, "error calling machine pause") } @@ -100,7 +102,7 @@ func (c *Client) Inspect(ctx context.Context) (VMData, error) { } request.Header.Add("content-type", "application/json") - response, err := c.client.Do(request) + response, err := c.client.Do(&retryablehttp.Request{Request: request}) if err != nil { return VMData{}, errors.Wrap(err, "error calling machine info") } From 49468d405c4d2eb07e43f01b0a5a411eb0370fc3 Mon Sep 17 00:00:00 2001 From: nabil salah Date: Wed, 18 Dec 2024 15:07:42 +0200 Subject: [PATCH 2/5] feat: use retryable http in zos upgarde hub and increase the max retry count Signed-off-by: nabil salah --- pkg/environment/config.go | 2 +- pkg/flist/flist.go | 4 ++-- pkg/provision/engine.go | 2 +- pkg/upgrade/hub/hub.go | 7 ++++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/environment/config.go b/pkg/environment/config.go index efa5640b1..10e919942 100644 --- a/pkg/environment/config.go +++ b/pkg/environment/config.go @@ -54,7 +54,7 @@ func GetConfig() (base Config, err error) { func GetConfigForMode(mode RunMode) (Config, error) { httpClient := retryablehttp.NewClient() httpClient.HTTPClient.Timeout = defaultHttpTimeout - httpClient.RetryMax = 3 + httpClient.RetryMax = 5 return getConfig(mode, baseExtendedURL, httpClient) } diff --git a/pkg/flist/flist.go b/pkg/flist/flist.go index fb47c87a7..4e9caa0e8 100644 --- a/pkg/flist/flist.go +++ b/pkg/flist/flist.go @@ -158,7 +158,7 @@ func newFlister(root string, storage volumeAllocator, commander commander, syste httpClient := retryablehttp.NewClient() httpClient.HTTPClient.Timeout = defaultHubCallTimeout - httpClient.RetryMax = 3 + httpClient.RetryMax = 5 return &flistModule{ root: root, flist: filepath.Join(root, "flist"), @@ -740,7 +740,7 @@ func (f *flistModule) downloadInNamespace(name, u string) (resp *http.Response, return con, nil }, } - cl.RetryMax = 3 + cl.RetryMax = 5 resp, err = cl.Get(u) return err diff --git a/pkg/provision/engine.go b/pkg/provision/engine.go index 3254376a4..51e6e0d48 100644 --- a/pkg/provision/engine.go +++ b/pkg/provision/engine.go @@ -1215,7 +1215,7 @@ func isTwinVerified(twinID uint32) (verified bool, err error) { cl := retryablehttp.NewClient() cl.HTTPClient.Timeout = defaultHttpTimeout - cl.RetryMax = 3 + cl.RetryMax = 5 response, err := cl.Do(&retryablehttp.Request{Request: request}) if err != nil { diff --git a/pkg/upgrade/hub/hub.go b/pkg/upgrade/hub/hub.go index b6b469642..7293aee5c 100644 --- a/pkg/upgrade/hub/hub.go +++ b/pkg/upgrade/hub/hub.go @@ -297,9 +297,10 @@ func (b *Regular) Files(repo string) ([]FileInfo, error) { } u.Path = filepath.Join("api", "flist", repo, b.Name) - cl := &http.Client{ - Timeout: defaultHubCallTimeout, - } + + cl := retryablehttp.NewClient() + cl.RetryMax = 5 + cl.HTTPClient.Timeout = defaultHubCallTimeout response, err := cl.Get(u.String()) if err != nil { From 9c7700dde1a56ac3accd8f2275b97b40b156f890 Mon Sep 17 00:00:00 2001 From: nabil salah Date: Thu, 19 Dec 2024 16:51:26 +0200 Subject: [PATCH 3/5] remove: request wrapping Signed-off-by: nabil salah --- pkg/provision/engine.go | 2 +- pkg/vm/client.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/provision/engine.go b/pkg/provision/engine.go index 51e6e0d48..d8cd1af47 100644 --- a/pkg/provision/engine.go +++ b/pkg/provision/engine.go @@ -1217,7 +1217,7 @@ func isTwinVerified(twinID uint32) (verified bool, err error) { cl.HTTPClient.Timeout = defaultHttpTimeout cl.RetryMax = 5 - response, err := cl.Do(&retryablehttp.Request{Request: request}) + response, err := cl.StandardClient().Do(request) if err != nil { return } diff --git a/pkg/vm/client.go b/pkg/vm/client.go index bc9552325..6e76d7906 100644 --- a/pkg/vm/client.go +++ b/pkg/vm/client.go @@ -45,7 +45,7 @@ func (c *Client) Shutdown(ctx context.Context) error { if err != nil { return err } - response, err := c.client.Do(&retryablehttp.Request{Request: request}) + response, err := c.client.StandardClient().Do(request) if err != nil { return errors.Wrap(err, "error calling machine shutdown") } @@ -63,7 +63,7 @@ func (c *Client) Pause(ctx context.Context) error { if err != nil { return err } - response, err := c.client.Do(&retryablehttp.Request{Request: request}) + response, err := c.client.StandardClient().Do(request) if err != nil { return errors.Wrap(err, "error calling machine pause") } @@ -81,7 +81,7 @@ func (c *Client) Resume(ctx context.Context) error { if err != nil { return err } - response, err := c.client.Do(&retryablehttp.Request{Request: request}) + response, err := c.client.StandardClient().Do(request) if err != nil { return errors.Wrap(err, "error calling machine pause") } @@ -102,7 +102,7 @@ func (c *Client) Inspect(ctx context.Context) (VMData, error) { } request.Header.Add("content-type", "application/json") - response, err := c.client.Do(&retryablehttp.Request{Request: request}) + response, err := c.client.StandardClient().Do(request) if err != nil { return VMData{}, errors.Wrap(err, "error calling machine info") } From 565c1b85f85bd8f49ab1bb4fff5e1261d4e08c97 Mon Sep 17 00:00:00 2001 From: nabil salah Date: Wed, 1 Jan 2025 18:21:11 +0200 Subject: [PATCH 4/5] feat: use retryable http on more clients Signed-off-by: nabil salah --- client/_http/node.go | 9 +++++---- cmds/identityd/ssh.go | 3 ++- pkg/environment/config.go | 4 ++-- pkg/geoip/geoip.go | 8 ++++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/client/_http/node.go b/client/_http/node.go index fa2dbc0ef..83f3f8cf1 100644 --- a/client/_http/node.go +++ b/client/_http/node.go @@ -9,6 +9,7 @@ import ( "net/http" "path/filepath" + "github.com/hashicorp/go-retryablehttp" "github.com/pkg/errors" "github.com/threefoldtech/zos/pkg/gridtypes" ) @@ -85,7 +86,7 @@ func (n *NodeClient) Deploy(dl *gridtypes.Deployment, update bool) error { return errors.Wrap(err, "failed to sign request") } - response, err := http.DefaultClient.Do(request) + response, err := retryablehttp.DefaultClient.Do(request) if err != nil { return err } @@ -110,7 +111,7 @@ func (n *NodeClient) Get(twin, deployment uint32) (dl gridtypes.Deployment, err return dl, errors.Wrap(err, "failed to sign request") } - response, err := http.DefaultClient.Do(request) + response, err := retryablehttp.DefaultClient.Do(request) if err != nil { return dl, err } @@ -135,7 +136,7 @@ func (n *NodeClient) Delete(twin, deployment uint32) (err error) { return errors.Wrap(err, "failed to sign request") } - response, err := http.DefaultClient.Do(request) + response, err := retryablehttp.DefaultClient.Do(request) if err != nil { return err } @@ -155,7 +156,7 @@ func (n *NodeClient) Counters() (total gridtypes.Capacity, used gridtypes.Capaci return total, used, errors.Wrap(err, "failed to build request") } - response, err := http.DefaultClient.Do(request) + response, err := retryablehttp.DefaultClient.Do(request) if err != nil { return total, used, err } diff --git a/cmds/identityd/ssh.go b/cmds/identityd/ssh.go index b2d88cce6..2210b4891 100644 --- a/cmds/identityd/ssh.go +++ b/cmds/identityd/ssh.go @@ -10,6 +10,7 @@ import ( "time" "github.com/cenkalti/backoff" + "github.com/hashicorp/go-retryablehttp" "github.com/rs/zerolog/log" "github.com/threefoldtech/zos/pkg" "github.com/threefoldtech/zos/pkg/environment" @@ -72,7 +73,7 @@ func manageSSHKeys() error { for _, user := range authorizedUsers { fetchKey := func() error { - res, err := http.Get(fmt.Sprintf("https://github.com/%s.keys", user)) + res, err := retryablehttp.Get(fmt.Sprintf("https://github.com/%s.keys", user)) if err != nil { return fmt.Errorf("failed to fetch user keys: %+w", err) diff --git a/pkg/environment/config.go b/pkg/environment/config.go index 10e919942..89b5f1bdd 100644 --- a/pkg/environment/config.go +++ b/pkg/environment/config.go @@ -56,7 +56,7 @@ func GetConfigForMode(mode RunMode) (Config, error) { httpClient.HTTPClient.Timeout = defaultHttpTimeout httpClient.RetryMax = 5 - return getConfig(mode, baseExtendedURL, httpClient) + return getConfig(mode, baseExtendedURL, httpClient.StandardClient()) } func uniqueStr(slice []string) []string { @@ -71,7 +71,7 @@ func uniqueStr(slice []string) []string { return list } -func getConfig(run RunMode, url string, httpClient *retryablehttp.Client) (ext Config, err error) { +func getConfig(run RunMode, url string, httpClient *http.Client) (ext Config, err error) { if !strings.HasSuffix(url, "/") { url += "/" } diff --git a/pkg/geoip/geoip.go b/pkg/geoip/geoip.go index b270b2378..d7a10651a 100644 --- a/pkg/geoip/geoip.go +++ b/pkg/geoip/geoip.go @@ -3,9 +3,9 @@ package geoip import ( "encoding/json" "errors" - "net/http" "time" + "github.com/hashicorp/go-retryablehttp" "github.com/rs/zerolog/log" ) @@ -22,9 +22,7 @@ type Location struct { var ( geoipURLs = []string{"https://geoip.grid.tf/", "https://02.geoip.grid.tf/", "https://03.geoip.grid.tf/"} - defaultHTTPClient = &http.Client{ - Timeout: 10 * time.Second, - } + defaultHTTPClient = retryablehttp.NewClient() ) // Fetch retrieves the location of the system calling this function @@ -51,6 +49,8 @@ func getLocation(geoIPService string) (Location, error) { City: "Unknown", } + defaultHTTPClient.HTTPClient.Timeout = 10* time.Second + defaultHTTPClient.RetryMax = 5 resp, err := defaultHTTPClient.Get(geoIPService) if err != nil { return l, err From 7ecc25901d79a8cfd5b1795e7ca80568b4dd8791 Mon Sep 17 00:00:00 2001 From: nabil salah Date: Wed, 1 Jan 2025 18:31:35 +0200 Subject: [PATCH 5/5] fix:linting --- pkg/geoip/geoip.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/geoip/geoip.go b/pkg/geoip/geoip.go index d7a10651a..43966cbf3 100644 --- a/pkg/geoip/geoip.go +++ b/pkg/geoip/geoip.go @@ -49,7 +49,7 @@ func getLocation(geoIPService string) (Location, error) { City: "Unknown", } - defaultHTTPClient.HTTPClient.Timeout = 10* time.Second + defaultHTTPClient.HTTPClient.Timeout = 10 * time.Second defaultHTTPClient.RetryMax = 5 resp, err := defaultHTTPClient.Get(geoIPService) if err != nil {