Commit b5b72ac8 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Remove try/except block that hide an exception without explanations.

KeyError may be raised from many statements here, the try/except give no indications.
Also reduce block indentation for readability and add some comments.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1469 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent efc8a8ec
......@@ -60,37 +60,36 @@ class StorageServiceHandler(BaseServiceHandler):
if tid > self.app.tm.getLastTID():
raise UnexpectedPacketError
try:
t = self.app.tm[tid]
if t.lock(uuid): # all nodes are locked
# XXX: review needed:
# don't iterate over connections but search by uuid
# include client's uuid in Transaction object
# I have received all the answers now. So send a Notify
# Transaction Finished to the initiated client node,
# Invalidate Objects to the other client nodes, and Unlock
# Information to relevant storage nodes.
for c in app.em.getConnectionList():
uuid = c.getUUID()
if uuid is not None:
node = app.nm.getByUUID(uuid)
if node.isClient():
if node is t.getNode():
p = Packets.NotifyTransactionFinished(tid)
c.answer(p, t.getMessageId())
else:
p = Packets.InvalidateObjects(t.getOIDList(),
tid)
c.notify(p)
elif node.isStorage():
if uuid in t.getUUIDList():
p = Packets.UnlockInformation(tid)
c.notify(p)
self.app.tm.remove(tid)
except KeyError:
# What is this?
pass
# transaction locked on this storage node
t = self.app.tm[tid]
if not t.lock(uuid):
return
# all nodes are locked
# XXX: review needed:
# don't iterate over connections but search by uuid
# include client's uuid in Transaction object
# I have received all the answers now. So send a Notify
# Transaction Finished to the initiated client node,
# Invalidate Objects to the other client nodes, and Unlock
# Information to relevant storage nodes.
for c in app.em.getConnectionList():
uuid = c.getUUID()
if uuid is not None:
node = app.nm.getByUUID(uuid)
if node.isClient():
if node is t.getNode():
p = Packets.NotifyTransactionFinished(tid)
c.answer(p, t.getMessageId())
else:
c.notify(Packets.InvalidateObjects(t.getOIDList(), tid))
elif node.isStorage():
if uuid in t.getUUIDList():
c.notify(Packets.UnlockInformation(tid))
# remove transaction from manager
self.app.tm.remove(tid)
def notifyReplicationDone(self, conn, packet, offset):
uuid = conn.getUUID()
......
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