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