-
-
Notifications
You must be signed in to change notification settings - Fork 129
Description
According to the docs for Builder::idle_timeout, "idle connections in excess of min_idle will be closed at the next reaping after remaining idle past this duration." To me, this implies that connections that are not in excess of min_idle are kept alive; in my opinion, this is desirable, since creating a connection could be expensive.
However, it appears that the reaper closes any connections that have been alive or idle for too long; based on max_lifetime and idle_timeout, respectively. It then respawns enough connections to have min_idle connections available. This seems to be inconsistent with the docs, and is also less desirable in my opinion. My use case is:
- Creating connections is expensive
- I would like to keep one connection open at all times (
min_idle == 1) - I would like to close extra connections relatively quickly (for instance,
idle_timeout == Duration::from_secs(1))
However, this means that even if my application never requests a connection, the idle connection is refreshed basically every time the reaper is scheduled.