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 http.Client #27

Merged
merged 1 commit into from
Nov 23, 2022
Merged

reuse http.Client #27

merged 1 commit into from
Nov 23, 2022

Conversation

johejo
Copy link
Contributor

@johejo johejo commented Nov 23, 2022

Description

Reuse http.Client without initializing each time.

Related Issue

Motivation and Context

https://pkg.go.dev/net/http#Client

The Client's Transport typically has internal state (cached TCP connections), so Clients should be reused instead of created as needed. Clients are safe for concurrent use by multiple goroutines.

How Has This Been Tested?

Add a unit test.

Screenshots (if appropriate):

Copy link
Owner

@kenfdev kenfdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johejo Thanks for your contribution! Looks like a great way to optimize performance :)

@kenfdev kenfdev merged commit 0125c9f into kenfdev:master Nov 23, 2022
@kenfdev
Copy link
Owner

kenfdev commented Nov 23, 2022

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.

2 participants