Skip to content

fix(gclient): add timeout configuration methods and improve client initialization#4779

Open
hailaz wants to merge 4 commits into
masterfrom
fix/gclient_timeout
Open

fix(gclient): add timeout configuration methods and improve client initialization#4779
hailaz wants to merge 4 commits into
masterfrom
fix/gclient_timeout

Conversation

@hailaz

@hailaz hailaz commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

fix #4390 导致设置超时失效的问题

移除了ResponseHeaderTimeout的默认值,改为Timeout作为默认超时的设置。

Copilot AI review requested due to automatic review settings June 2, 2026 04:15
Comment thread net/gclient/gclient.go Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 to NewWithTimeout, and adds NewWithHttpClient for custom *http.Client initialization.
  • Adds transport-timeout configuration APIs (SetTransportTimeout + individual setters) and a SetTransport setter.
  • 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.

Comment thread net/gclient/gclient.go
Comment thread net/gclient/gclient.go Outdated
Comment thread net/gclient/gclient.go
Comment thread net/gclient/gclient_config.go
Comment thread net/gclient/gclient_config.go
Comment thread net/gclient/gclient_z_unit_test.go Outdated
Comment thread net/gclient/gclient_z_unit_test.go
Comment thread net/gclient/gclient_z_unit_test.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

Comment thread net/gclient/gclient.go
Comment thread net/gclient/gclient_z_unit_test.go Outdated
Comment thread net/gclient/gclient_z_unit_test.go Outdated
Comment thread net/gclient/gclient_z_unit_test.go Outdated
Comment thread net/gclient/gclient_z_unit_test.go Outdated
Comment thread net/gclient/gclient.go Dismissed
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.

3 participants