Skip to content

Ajmaidak try next host on timeout #637

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

larskanis
Copy link
Collaborator

No description provided.

Alexander J. Maidak and others added 6 commits April 8, 2025 14:03
libpq does not support connect_timeout when using the async api.

So when using the async connection API  with a multi-host connection
string libpq will not timeout connections to the first host in the
list and thus will not attempt to connect to any subsequent hosts
in the connection string list.

This fixes this by closing and reopenning the connection with a
reordered connection string when connection times out.

See discussion on the pgsql-hackers list discussing this "feature" of the api:
https://www.postgresql.org/message-id/flat/CA%2Bmi_8YyGKA9dWELu63e%3DKL2oN-%2BFe4uca4EtFfb6uQD4Up8pw%40mail.gmail.com
in case of several hosts and async API.

This is what libpq does in sync API as well.
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