Commit 8ffb54f6 authored by Vincent Pelletier's avatar Vincent Pelletier

Only call _unlockPending when first transaction is completely locked.

This prevents doing pop(0)/insert(0, ...) needlessly on the first item.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2570 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 88fb0b5f
......@@ -380,8 +380,8 @@ class TransactionManager(object):
"""
assert tid in self._tid_dict, "Transaction not started"
txn = self._tid_dict[tid]
if txn.lock(uuid):
# all storage are locked
if txn.lock(uuid) and self._queue[0][1] == tid:
# all storage are locked and we unlock the commit queue
self._unlockPending()
def forget(self, uuid):
......@@ -389,9 +389,12 @@ class TransactionManager(object):
A storage node has been lost, don't expect a reply from it for
current transactions
"""
unlock = False
# iterate over a copy because _unlockPending may alter the dict
for tid, txn in self._tid_dict.items():
if txn.forget(uuid):
if txn.forget(uuid) and self._queue[0][1] == tid:
unlock = True
if unlock:
self._unlockPending()
def _unlockPending(self):
......
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