diff --git a/sql/engines/pgsql.py b/sql/engines/pgsql.py index 27ef8272e8..1444116554 100644 --- a/sql/engines/pgsql.py +++ b/sql/engines/pgsql.py @@ -29,7 +29,7 @@ def get_connection(self, db_name=None): if self.conn: return self.conn self.conn = psycopg2.connect(host=self.host, port=self.port, user=self.user, - password=self.password, dbname=db_name) + password=self.password, dbname=db_name, connect_timeout=10) return self.conn @property diff --git a/sql/engines/redis.py b/sql/engines/redis.py index 64707ba814..99b90a94bb 100644 --- a/sql/engines/redis.py +++ b/sql/engines/redis.py @@ -26,7 +26,7 @@ class RedisEngine(EngineBase): def get_connection(self, db_name=None): db_name = db_name or self.db_name return redis.Redis(host=self.host, port=self.port, db=db_name, password=self.password, - encoding_errors='ignore', decode_responses=True) + encoding_errors='ignore', decode_responses=True, socket_connect_timeout=10) @property def name(self):