Skip to content

Conversation

PonasKovas
Copy link

@PonasKovas PonasKovas commented Sep 4, 2025

Does your PR solve an issue?

Fixes #4014

Is this a breaking change?

No, this does not affect the public API, only the internal implementation.

Summary of changes

  • Completely removed the match for specific IO error kinds (40e5883). As far as I understand it has no function, except being a source of bugs by missing possible kinds (like currently ConnectionReset was not included for some reason).
  • Added an internal connection_with_recovery() method which is basically the same as connection(), but on failure to connect to the database it retries max 5 times (with a very basic back-off strategy)
  • Added an internal recv_without_recovery() method which is just try_recv() simplified, without any connection recovery strategies. The intention is to group the initial IO-fallible calls together.
  • Rewrote try_recv method to use recv_without_recovery(), matching any IO error and trying to reconnect using connection_with_recovery()

This appears to pass my internal tests simulating a connection disruption to the database.

Looking forward to comments and insights

@PonasKovas PonasKovas requested a review from abonander September 9, 2025 09:43
@PonasKovas
Copy link
Author

Is there anything I could do to help speed up the process of merging this PR?

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.

PgListener::try_recv doesnt match for ConnectionReset
2 participants