mirror of
https://github.com/kennethreitz/django-postgrespool.git
synced 2026-06-05 23:00:19 +00:00
Merge pull request #13 from Jonty/master
Correctly invalidate connections on failure.
This commit is contained in:
@@ -108,7 +108,7 @@ class DatabaseWrapper(Psycopg2DatabaseWrapper):
|
||||
self.creation = DatabaseCreation(self)
|
||||
|
||||
def _cursor(self):
|
||||
if self.connection is None:
|
||||
if self.connection is None or self.connection.is_valid == False:
|
||||
self.connection = db_pool.connect(**self._get_conn_params())
|
||||
self.connection.set_client_encoding('UTF8')
|
||||
tz = 'UTC' if settings.USE_TZ else self.settings_dict.get('TIME_ZONE')
|
||||
|
||||
Reference in New Issue
Block a user