-
-
Notifications
You must be signed in to change notification settings - Fork 504
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sfackler
merged 7 commits into
sfackler:master
from
PG-kura:support-keepalive-interval-and-retries
Aug 27, 2022
Merged
Support keepalive interval and retries. #944
sfackler
merged 7 commits into
sfackler:master
from
PG-kura:support-keepalive-interval-and-retries
Aug 27, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sfackler
reviewed
Aug 26, 2022
sfackler
reviewed
Aug 27, 2022
Looks good to me other than the one comment! |
sfackler
reviewed
Aug 27, 2022
sfackler
reviewed
Aug 27, 2022
sfackler
reviewed
Aug 27, 2022
sfackler
reviewed
Aug 27, 2022
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 of socket2::TcpKeepalive.Implementation
I thought that adding
keepalives_interval
andkeepalives_retries
blindly would increase the number of arguments for the connect_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
.