Commit fc247c7d authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Matevz Golob

ZMySQLDA.db: Clarify that reconnection will only happen on actually closed connections.

So that it's more apparent that we are not leaking a potentially active
transaction on that connection.
parent ce9c16db
...@@ -358,13 +358,13 @@ class DB(TM): ...@@ -358,13 +358,13 @@ class DB(TM):
raise OperationalError(m[0], '%s: %s' % (m[1], query)) raise OperationalError(m[0], '%s: %s' % (m[1], query))
if m[0] in lock_error: if m[0] in lock_error:
raise ConflictError('%s: %s: %s' % (m[0], m[1], query)) raise ConflictError('%s: %s: %s' % (m[0], m[1], query))
if not allow_reconnect and self._use_TM or \ if (allow_reconnect or not self._use_TM) and \
m[0] not in hosed_connection: m[0] in hosed_connection:
LOG('ZMySQLDA', ERROR, 'query failed: %s' % (query,)) self._forceReconnection()
raise self.db.query(query)
# Hm. maybe the db is hosed. Let's restart it. else:
self._forceReconnection() LOG('ZMySQLDA', ERROR, 'query failed: %s' % (query,))
self.db.query(query) raise
except ProgrammingError: except ProgrammingError:
LOG('ZMySQLDA', ERROR, 'query failed: %s' % (query,)) LOG('ZMySQLDA', ERROR, 'query failed: %s' % (query,))
raise raise
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment