close validation mongo connection

This commit is contained in:
iLLiCiTiT 2021-03-31 15:26:44 +02:00
parent e8c52214dc
commit 75f9fd7d1c

View file

@ -131,6 +131,7 @@ def validate_mongo_connection(cnx: str) -> (bool, str):
try:
client = MongoClient(**mongo_args)
client.server_info()
client.close()
except ServerSelectionTimeoutError as e:
return False, f"Cannot connect to server {cnx} - {e}"
except ValueError: