-
Sometimes my pgx Pool closes and all the database accesses return |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
I found mentions of how the pool should never be closed unless you call |
Beta Was this translation helpful? Give feedback.
-
This is correct. The only way a pgxpool is closed is by calling
That is correct, it does block. But it's not clear what the alternative would be. What is the state of a pool where But most of the time, pools are never closed or only closed at program termination. They should live as long as the program execution does. On the rare occasions that a pool needs to be closed a goroutine can be used to close the pool in a non-blocking way. |
Beta Was this translation helpful? Give feedback.
-
Forcibly shutting it down after context cancels. I only use I assumed it was beneficial to call the |
Beta Was this translation helpful? Give feedback.
-
I seem to have tracked down the original issue and you were totally correct that I was caling It mistakenly led me to believe that calling Anyways thanks for help with this. |
Beta Was this translation helpful? Give feedback.
This is correct. The only way a pgxpool is closed is by calling
Close()
. Any errors encountered using the pool will only affect the underlying connections. I strongly suspect your application is inadvertently closing the pool.That is correct, it does block. But it's not clear what the alternative would be. What is the state of a pool where
…