From 234edd339c7136f3f78c4c522c30f53c53e0496c Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Wed, 13 Sep 2017 14:38:28 +0300 Subject: [PATCH] MySQL: add connection timeout for bad hosts --- redash/query_runner/mysql.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/redash/query_runner/mysql.py b/redash/query_runner/mysql.py index 903f4787..c1ae2629 100644 --- a/redash/query_runner/mysql.py +++ b/redash/query_runner/mysql.py @@ -137,7 +137,8 @@ class Mysql(BaseSQLQueryRunner): db=self.configuration['db'], port=self.configuration.get('port', 3306), charset='utf8', use_unicode=True, - ssl=self._get_ssl_parameters()) + ssl=self._get_ssl_parameters(), + connect_timeout=60) cursor = connection.cursor() logger.debug("MySQL running query: %s", query) cursor.execute(query)