hyperium / hyper

An HTTP library for Rust
https://hyper.rs
MIT License
14.58k stars 1.6k forks source link

Allows users to configure the idletimeout and idle check interval. #2555

Closed silence-coding closed 1 year ago

silence-coding commented 3 years ago

The current idle check time and interval are the same parameter. The idle timeout and idle check interval can be configured separately.

https://github.com/hyperium/hyper/blob/4cd06bf25661d7e43e2fdf43eabdb8508055cf3a/src/client/pool.rs#L408 https://github.com/hyperium/hyper/blob/4cd06bf25661d7e43e2fdf43eabdb8508055cf3a/src/client/pool.rs#L448

seanmonstar commented 3 years ago

Could you explain the motivation for wanting to configure them separately? That it's an interval at all is just an internal detail that I wouldn't normally consider exposing, but I'm curious.

silence-coding commented 3 years ago

One way to configure idle time is to avoid that when the client sends a request, the server is disconnected. Therefore, a mandatory requirement is that the idle time configured on the client must be less than the idle time configured on the server to avoid the awkward time point.

silence-coding commented 3 years ago

The idle precision of the current implementation is poor. Therefore, the current practice is to set the idle time as conservative as possible.

silence-coding commented 2 years ago

Is there a follow-up to this question? If not, I will close this issue.