I have an application with many threads using a PersistentConnectionPool.
It works great, until someone restarts the database, disconnecting all connections in the pool.
So, what can I do to recover the connections when the server restart?
I was thinking about catching psycopg2.OperationalError in a try/except statement, executing a pool.putconn(conn, close=True) to close the problematic connection, then trying to execute the SQL query again. Though, I'm not sure if the PersistentConnectionPool class would create a new connection afterwards, or if this is the right way to do it...
Thanks,
--
Diego G. Pasqualin
UFPR - Universidade Federal do Paraná
C3SL - Centro de Computação Científica e Software Livre