Commit 4e5eba85 authored by Vincent Pelletier's avatar Vincent Pelletier

Replace try..except block with a condition.

Either the transaction got the load lock for all its objects, or it got it
for none. So instead of having a "try..except" block which either passes
or catches for each iteration, use a simple test.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1655 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 5efcbea0
......@@ -199,18 +199,15 @@ class TransactionManager(object):
# XXX: this happen sometimes, explain or fix
return
transaction = self._transaction_dict[tid]
has_load_lock = transaction.isLocked()
# if the transaction is locked, ensure we can drop it
if not even_if_locked and transaction.isLocked():
if not even_if_locked and has_load_lock:
return
# unlock any object
for oid in transaction.getOIDList():
# XXX: we release locks without checking if tid owns them
try:
if has_read_lock:
# XXX: we release locks without checking if tid owns them
del self._load_lock_dict[oid]
except KeyError:
# The transaction may have not been lock when abort is called,
# so no read lock can be held
pass
del self._store_lock_dict[oid]
# _uuid_dict entry will be deleted at node disconnection
self._uuid_dict[transaction.getUUID()].discard(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