Skip to content
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

Handle connection timeout and multiple addresses per host #459

Merged
merged 18 commits into from Jun 14, 2022

Conversation

larskanis
Copy link
Collaborator

This PR is much bigger than intended. It includes #453, since hostaddr and conninfo_parse are a dependency of this PR.

As written in #450 (comment) there is a compatibility issue in libpq, which doesn't allow to combine non-blocking connection establishment, multiple hosts and the connect_timeout option.

This PR solves the issue by splitting the host string into single hosts and calling the underlying libpq with each single host, one after another. That way the timeout can be applied per host.

This PR also replaces our own URI and connection string parser by libpq's conninfo_parse. It simplifies our connection string handling.

This PR also separates specs, that are only applicable to the PG::Connection.async_exec=true case. This is necessary to verify that multiple connections attempts are executed.

This PR also fixes issue #458, which I stumbled upon in one of the new test cases.

This PR also fixes issue #452, so that two connection attempts are made, when a single host has both IPv4 and IPv6 addresses.

Fixes #452
Fixes #450
Fixes #458
Closes #453

@larskanis larskanis merged commit 4e65702 into ged:master Jun 14, 2022
@larskanis larskanis deleted the timeout branch June 16, 2022 11:13
@larskanis larskanis mentioned this pull request Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant