Skip to content

Conversation

alkeryn
Copy link

@alkeryn alkeryn commented Jul 8, 2025

instead of hanging until the timeout and returning a PoolTimedOut error

Does your PR solve an issue?

fixes #744
this also would fix a bunch of duplicate / similar issues, didn't take the time to list them all.

Is this a breaking change?

following the last commit, no, it's a new options when creating the pool.

as mentioned by my comment in the issue :

if your db goes down you don't want users to have to wait a few seconds to get an error when they could get some 500 error immediately.

i understand that the pr may need some edits, but i wanted this issue to get some attention.

@alkeryn
Copy link
Author

alkeryn commented Jul 10, 2025

made it optional with the .return_con_refused() function that takes a bool.
this should no longer be a breaking change.

@alkeryn alkeryn force-pushed the pool_connection_refused_fix branch from 01373ef to 3e77113 Compare July 10, 2025 13:23
@alkeryn alkeryn changed the title sqlx pools immediately return ConnectionRefused errors instead of hanging and returning PoolTimedOut sqlx-core pools immediately return ConnectionRefused errors instead of hanging and returning PoolTimedOut Jul 10, 2025
@alkeryn alkeryn changed the title sqlx-core pools immediately return ConnectionRefused errors instead of hanging and returning PoolTimedOut sqlx-core pools optionally immediately return ConnectionRefused errors instead of hanging and returning PoolTimedOut Jul 10, 2025
it is now possible to set return_con_refused to true so that connection
refused errors are immediately returned instead of hanging until the
timeout and returning a PoolTimedOut error
@alkeryn alkeryn force-pushed the pool_connection_refused_fix branch from 3e77113 to 1583df2 Compare July 10, 2025 13:59
@alkeryn
Copy link
Author

alkeryn commented Aug 19, 2025

hey @abonander could this get a review ?
thank you !

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.

PoolOptions<Postgres>::connect does not error out on connection error
1 participant