mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #23870 from kaithar/issue/attempt-reconnect
MySQL can go away, this seems the most reliable way of checking it's …
This commit is contained in:
commit
64fc2944d9
@ -190,10 +190,17 @@ def _get_serv(ret=None, commit=False):
|
||||
'''
|
||||
_options = _get_options(ret)
|
||||
|
||||
connect = True
|
||||
if __context__ and 'mysql_returner_conn' in __context__:
|
||||
log.debug('Reusing MySQL connection pool')
|
||||
conn = __context__['mysql_returner_conn']
|
||||
else:
|
||||
try:
|
||||
log.debug('Trying to reuse MySQL connection pool')
|
||||
conn = __context__['mysql_returner_conn']
|
||||
conn.ping()
|
||||
connect = False
|
||||
except MySQLdb.connections.OperationalError as exc:
|
||||
log.debug('OperationalError on ping: {0}'.format(exc))
|
||||
|
||||
if connect:
|
||||
log.debug('Generating new MySQL connection pool')
|
||||
try:
|
||||
# An empty ssl_options dictionary passed to MySQLdb.connect will
|
||||
|
Loading…
Reference in New Issue
Block a user