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

HTTP client timeout improvements #4937

Merged
merged 3 commits into from
Nov 9, 2023
Merged

HTTP client timeout improvements #4937

merged 3 commits into from
Nov 9, 2023

Conversation

vietj
Copy link
Member

@vietj vietj commented Nov 9, 2023

The way HTTP client timeouts does not meet all the expectations.

The timeout present on RequestOptions applies for the time to obtain a connection and then configures the idle timeout of the request.

We should add to RequestOptions a connectTimeout applied when a request is obtained from the client pool and an idleTimeout applied to the HttpClientRequest after it has been obtained from the pool, to configure timeouts separately when necessary.

HttpClientRequest now has a setIdleTimeout method which is a bare rename of setTimeout and better carries the meaning of the method.

In addition it should be easier to define a global timeout when interacting with an HTTP server that is not captured by connect or idle timeout. The Future interface now has a timeout method allowing to define a timeout when obtaining a result, e.g. the result of an HTTP client interaction with a server.

@vietj vietj added this to the 4.5.0 milestone Nov 9, 2023
@vietj vietj self-assigned this Nov 9, 2023
vietj added 2 commits November 9, 2023 17:34
… It acts both as a connect and idle timeout.

Introduce separate connect and idle timeouts for HTTP client, the connect timeout fires when a request has not been obtained from the pool in time, the idle timeout is a rename of the existing timeout (on HttpClientRequest).

RequestOptions deprecates the timeout property and introduces a connect timeout and an idle timeout. To achieve the same effect both connect/idle timeouts can be set.

HttpClientRequest deprecates the setTimeout method in favor of setIdleTimeout which is a better and explicit name.
…nteed result within a time limit. When the timeout fires, the future is failed with a TimeoutException.
@vietj vietj force-pushed the http-client-timeout-4.x branch from de0cd77 to 0458aa3 Compare November 9, 2023 16:40
@vietj vietj merged commit 27b9a77 into 4.x Nov 9, 2023
6 checks passed
@vietj vietj deleted the http-client-timeout-4.x branch November 9, 2023 19:35
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.

1 participant