coleifer/peewee — pull request #444 by alexlatchford (2014-10-08 03:27:15+00:00)
Title: Add in detection of closed connections in the pool

Hi Charles,

I've got a little problem with connection pooling, it works great up until the point I have to kill a hanging postgres query or stop the database service. This gets an infinite `InterfaceError: connection already closed` from the psycopg2 library after it successfully retrieves a connection from `_connect`.

The problem is that the connection pool is only aware of connections killed by the application and not the database server itself. This pull is my attempt to monkey patch a solution for postgres, I had a brief look into the MySQLdb and pymysql docs to try to also get a good solution for that but fell short so thought I'd pass it over to you to see what you thought.

Other than this minor problem, where it can be fixed by restarting the webserver process (thus flushing the connection pool) this module has been running really well for me, thanks again :)

Cheers,
Alex