Added DB connection timeout

Added a timeout of 3 seconds when trying to connect to the database.
dev
Peery 2 years ago
parent ccf4e1feb5
commit 9733828897

@ -11,7 +11,8 @@ class DBAdapter:
self.db = None
self.db_cursor = None
try:
self.db = psycopg2.connect(host=host, port=port, database=database, user=user, password=password)
self.db = psycopg2.connect(host=host, port=port, database=database, user=user, password=password,
connect_timeout=3)
self.db_cursor = self.db.cursor()
except psycopg2.OperationalError as e:

Loading…
Cancel
Save