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,9 +60,12 @@ class StorageServiceHandler(BaseServiceHandler): ...@@ -60,9 +60,12 @@ 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):
return
# all nodes are locked
# XXX: review needed: # XXX: review needed:
# don't iterate over connections but search by uuid # don't iterate over connections but search by uuid
# include client's uuid in Transaction object # include client's uuid in Transaction object
...@@ -80,17 +83,13 @@ class StorageServiceHandler(BaseServiceHandler): ...@@ -80,17 +83,13 @@ class StorageServiceHandler(BaseServiceHandler):
p = Packets.NotifyTransactionFinished(tid) p = Packets.NotifyTransactionFinished(tid)
c.answer(p, t.getMessageId()) c.answer(p, t.getMessageId())
else: else:
p = Packets.InvalidateObjects(t.getOIDList(), c.notify(Packets.InvalidateObjects(t.getOIDList(), tid))
tid)
c.notify(p)
elif node.isStorage(): elif node.isStorage():
if uuid in t.getUUIDList(): if uuid in t.getUUIDList():
p = Packets.UnlockInformation(tid) c.notify(Packets.UnlockInformation(tid))
c.notify(p)
# remove transaction from manager
self.app.tm.remove(tid) self.app.tm.remove(tid)
except KeyError:
# What is this?
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