Skip to content

Recommendations dealing with Auto-suspend (Dead Connections) #1838

Answered by jackc
cruzluna asked this question in Q&A
Discussion options

You must be logged in to vote

If that error only when the system has been idle for a while then I would expect the pool to handle it automatically. Connections that have been idle for > 1 second automatically do a ping on acquire. If the ping fails another connection is used (or created if necessary).

If that doesn't work, then the BeforeAcquire hook in pgxpool would allow you to manually test the connection, presumably with a ping, before usage.

Lastly, you can call Conn.Ping manually to ensure a connection is alive.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cruzluna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants