- Notifications
You must be signed in to change notification settings - Fork516
Support keepalive interval and retries.#944
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Support keepalive interval and retries.#944
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Looks good to me other than the one comment! |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Thanks! |
hello. I use tokio-postgres a lot.
Thing I want to do
I would like to customize interval and retries when keepalive is turned on.
Therefore, I propose to make it possible to specify the keepalive interval and retries in this pull-request.
Features to add
Previously, the only keepalive parameter was
keepalives_idle
. This time, addkeepalives_interval
andkeepalives_retries
.keepalives_interval
is available on neither Redox nor Solaris.keepalives_retries
is available on neither Redox, Solaris nor Windows. This constraint aligns with that ofsocket2::TcpKeepalive.Implementation
I thought that adding
keepalives_interval
andkeepalives_retries
blindly would increase the number of arguments for theconnect_socket::connect_socket() and make the source code messy.So I defined a new struct
KeepaliveConfig
. It does not publish outside the crate.As an alternative, I considered putting
socket2::TcpKeepalive
inConfig
, but I rejected it becausesocket2::TcpKeepalive
has no getter method and is incompatible withConfig
.