MySQL: add connection timeout for bad hosts

This commit is contained in:
Arik Fraimovich 2017-09-13 14:38:28 +03:00
parent 5b54a777d9
commit 234edd339c

View File

@ -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)