Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse the same HTTP client for all requests. #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nguyen-phillip
Copy link
Collaborator

@nguyen-phillip nguyen-phillip commented Dec 13, 2024

Before: Almost every HTTP GET request went through client.Get, which created a new http.Transport (inside of http.DefaultClient) for each request. The code in verify.Command created its own http.Client separately from client.Get.

After: googet creates a single http.Client via NewDownloader, which is reused for all requests, per https://pkg.go.dev/net/http#hdr-Clients_and_Transports. The downloader is passed through to anything that needs it (in place of the proxyServer URL that was formerly being passed around). verify.Command uses this same downloader.

* create a client.Downloader wrapper around http.Client
* don't pass around the proxyServer URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants