fix(gclient): add timeout configuration methods and improve client initialization#4779
Open
hailaz wants to merge 4 commits into
Open
fix(gclient): add timeout configuration methods and improve client initialization#4779hailaz wants to merge 4 commits into
hailaz wants to merge 4 commits into
Conversation
… to Transport field
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the regression introduced by #4390 where user-configured timeouts could become ineffective by separating http.Client.Timeout from transport-level timeouts, and adding APIs to configure each explicitly.
Changes:
- Refactors client construction:
New()now delegates toNewWithTimeout, and addsNewWithHttpClientfor custom*http.Clientinitialization. - Adds transport-timeout configuration APIs (
SetTransportTimeout+ individual setters) and aSetTransportsetter. - Adds unit tests covering the new timeout APIs and constructor behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| net/gclient/gclient.go | Adds new constructors and refactors default client initialization/transport setup. |
| net/gclient/gclient_config.go | Adds timeout configuration methods for transport-level timeouts and SetTransport. |
| net/gclient/gclient_z_unit_test.go | Adds tests validating client timeout vs transport timeout behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…for nil checks and timeout settings
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.
fix #4390 导致设置超时失效的问题
移除了ResponseHeaderTimeout的默认值,改为Timeout作为默认超时的设置。