pgsql: fix self._conn.close() being called without connection
If an error occurs on connection establishment, self._conn is None so it can't be closed. Change-Id: If6fce24cb27aa7090b5165ca4a895c846c40d2dd
This commit is contained in:
parent
413527c181
commit
90a56b0ab6
|
@ -146,7 +146,8 @@ class PostgresLock(locking.Lock):
|
|||
try:
|
||||
return _lock()
|
||||
except Exception:
|
||||
self._conn.close()
|
||||
if self._conn:
|
||||
self._conn.close()
|
||||
raise
|
||||
|
||||
def release(self):
|
||||
|
|
Loading…
Reference in New Issue