Commit 07ad98d2 authored by Vincent Pelletier's avatar Vincent Pelletier

ZMySQLDA: Check if connection is still alive in tpc_vote.

To make it more likely detect killed transactions before entering
tpc_finish phase.
parent 95e7d36a
...@@ -412,6 +412,11 @@ class DB(TM): ...@@ -412,6 +412,11 @@ class DB(TM):
error=sys.exc_info()) error=sys.exc_info())
raise raise
def tpc_vote(self, *ignored):
# Raise if a disconnection is detected, to avoid detecting this later
self._query("SELECT 1")
return TM.tpc_vote(self, *ignored)
def _finish(self, *ignored): def _finish(self, *ignored):
"""Commit a transaction (when TM is enabled).""" """Commit a transaction (when TM is enabled)."""
if not self._transaction_begun: if not self._transaction_begun:
...@@ -585,4 +590,5 @@ class DeferredDB(DB): ...@@ -585,4 +590,5 @@ class DeferredDB(DB):
del self._sql_string_list[:] del self._sql_string_list[:]
DB._finish(self) DB._finish(self)
tpc_vote = TM.tpc_vote
_abort = _begin _abort = _begin
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