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

Reset connection #42

Open
ysbaddaden opened this issue May 12, 2016 · 2 comments
Open

Reset connection #42

ysbaddaden opened this issue May 12, 2016 · 2 comments

Comments

@ysbaddaden
Copy link
Contributor

Could we had a mecanism to detect a connection issue and to reset the connection? Maybe wrapping the thrown socket Errno as PQ::SocketError and adding PQ::Connection#reset and PG::Connection#reset methods?

This is useful when a connection gets staled or broken, which happens regularly on the Heroku free plans. I used to catch PG::Error exceptions, call LibPQ.reset once before retrying, as long as the reset didn't fail. Namely those two patches: ysbaddaden/frost@184642c and ysbaddaden/frost@b3c1586

@will
Copy link
Owner

will commented May 16, 2016

Adding those methods and wrapping does sound like a good solution. Is there a particular Errno that you see when the connection is dropped? I'll get to this sometime soon, but would accept a patch from anyone that wants to do this.

Related, it would also be possible to try to reconnect in the driver itself, but we wouldn't want to spin trying to reconnect forever. Maybe either one retry or exponential backoff. Not sure if that belongs in the driver or not though.

@benoist
Copy link

benoist commented Mar 7, 2017

Is this solved by using the Crystal DB connection or does the problem still exist?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants