Close connection after testing the database
issue9629 review302191002
This commit is contained in:
1 parent
81bade4035
commit
99135bf9db
1 file changed
+7
-4
@@ -280,10 +280,13 @@ class Database(DatabaseInterface):
|
||||
res = []
|
||||
for db_name, in cursor:
|
||||
try:
|
||||
with connect(**self._connection_params(db_name)
|
||||
) as conn:
|
||||
if self._test(conn, hostname=hostname):
|
||||
res.append(db_name)
|
||||
conn = connect(**self._connection_params(db_name))
|
||||
try:
|
||||
with conn:
|
||||
if self._test(conn, hostname=hostname):
|
||||
res.append(db_name)
|
||||
finally:
|
||||
conn.close()
|
||||
except Exception:
|
||||
logger.debug(
|
||||
'Test failed for "%s"', db_name, exc_info=True)
|
||||
|
||||
Reference in new issue
Block a user