Don't update httpClient passed to NewClient#3011
Merged
gmlewis merged 1 commit intogoogle:masterfrom Dec 16, 2023
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3011 +/- ##
==========================================
- Coverage 97.91% 97.89% -0.03%
==========================================
Files 150 150
Lines 12980 12984 +4
==========================================
+ Hits 12710 12711 +1
- Misses 192 194 +2
- Partials 78 79 +1 ☔ View full report in Codecov by Sentry. |
gmlewis
approved these changes
Dec 1, 2023
Collaborator
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @WillAbides !
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
Collaborator
|
Thank you, @valbeat ! |
gmlewis
pushed a commit
to WillAbides/go-github
that referenced
this pull request
Dec 18, 2023
gmlewis
pushed a commit
to o-sama/go-github
that referenced
this pull request
Dec 19, 2023
This was referenced Jan 9, 2024
fkorotkov
added a commit
to cirruslabs/cirrus-cli
that referenced
this pull request
Feb 15, 2024
Use a single instance with tweaked defaults across all the invocations. Plus use newer API of `go-github` (including google/go-github#3011 fix). Previously a default client was used which doesn't have nor request timeout nor idle connection timeout. This resulted in poor `p99` performance since sometimes connections were hanging blocking others to access `github.com`.
fkorotkov
added a commit
to cirruslabs/cirrus-cli
that referenced
this pull request
Feb 16, 2024
* Optimize HTTP client used for GitHub Use a single instance with tweaked defaults across all the invocations. Plus use newer API of `go-github` (including google/go-github#3011 fix). Previously a default client was used which doesn't have nor request timeout nor idle connection timeout. This resulted in poor `p99` performance since sometimes connections were hanging blocking others to access `github.com`. * Renamed to `defaultGitHubClient`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Users can accidentally leak credentials by doing something like this:
This PR fixes that by updating
NewClientto make a copy of httpClient so that when its transport is updated byWithAuthToken, the original httpClient won't have its transport updated as well.It also updates
TestWithAuthTokento check for leaks