Commit ad3e2e8a authored by Aurel's avatar Aurel

set self.txn the latest as possible thus if connection to a node failed

in tpc_begin, all other call to storage method will return without error


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@232 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 75603e10
...@@ -418,11 +418,12 @@ class Application(object): ...@@ -418,11 +418,12 @@ class Application(object):
if self.txn == transaction: if self.txn == transaction:
# We already begin the same transaction # We already begin the same transaction
return return
self.txn = transaction
# Get a new transaction id if necessary # Get a new transaction id if necessary
if tid is None: if tid is None:
self.tid = None self.tid = None
conn = self.master_conn conn = self.master_conn
if conn is None:
raise NEOStorageError("Connection failed")
conn.lock() conn.lock()
try: try:
msg_id = conn.getNextId() msg_id = conn.getNextId()
...@@ -433,13 +434,13 @@ class Application(object): ...@@ -433,13 +434,13 @@ class Application(object):
self.dispatcher.register(conn, msg_id, self.getQueue()) self.dispatcher.register(conn, msg_id, self.getQueue())
finally: finally:
conn.unlock() conn.unlock()
# Wait for answer # Wait for answer
self._waitMessage(conn, msg_id) self._waitMessage(conn, msg_id)
if self.tid is None: if self.tid is None:
raise NEOStorageError('tpc_begin failed') raise NEOStorageError('tpc_begin failed')
else: else:
self.tid = tid self.tid = tid
self.txn = transaction
def store(self, oid, serial, data, version, transaction): def store(self, oid, serial, data, version, transaction):
......
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