From b2034c83607fa5799b3fb5f5678b02e1f0813a81 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Wed, 10 Jul 2024 10:12:55 +0700 Subject: [PATCH] feat: cache http client --- internal/config/config.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/config/config.go b/internal/config/config.go index 2b5d0bd..a6b4ca5 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -197,6 +197,8 @@ func (c *cfg) Download(appNames ...string) error { URL: p.URL, } + httpClient := &http.Client{} + eg.Go(func() error { if c.isDryRun { fmt.Printf("Download [%s] -> [%s]\n", p.URL, p.Internal) @@ -204,7 +206,7 @@ func (c *cfg) Download(appNames ...string) error { } // nolint:noctx,gosec - httpRsp, err := http.Get(p.URL) + httpRsp, err := httpClient.Get(p.URL) if err != nil { return fmt.Errorf("http client: failed to get: %w", err) }