Commit d7108e36 authored by Vincent Pelletier's avatar Vincent Pelletier

Instead of instantiating Packet once and mutating/sending it multiple time,...

Instead of instantiating Packet once and mutating/sending it multiple time, instanciate it once per send. This makes the code easier to test, and is already what is done in other places.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@367 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 095b03e4
......@@ -541,16 +541,17 @@ class Application(object):
node = nm.getNodeByUUID(uuid)
if node.getNodeType() == STORAGE_NODE_TYPE:
# Split the packet if too huge.
p = Packet()
row_list = []
for offset in xrange(self.num_partitions):
row_list.append((offset, self.pt.getRow(offset)))
if len(row_list) == 1000:
p = Packet()
p.sendPartitionTable(conn.getNextId(),
self.lptid, row_list)
conn.addPacket(p)
del row_list[:]
if len(row_list) != 0:
p = Packet()
p.sendPartitionTable(conn.getNextId(),
self.lptid, row_list)
conn.addPacket(p)
......
......@@ -548,10 +548,10 @@ class ServiceEventHandler(MasterEventHandler):
# Transaction Finished to the initiated client node,
# Invalidate Objects to the other client nodes, and Unlock
# Information to relevant storage nodes.
p = Packet()
for c in app.em.getConnectionList():
uuid = c.getUUID()
if uuid is not None:
p = Packet()
node = app.nm.getNodeByUUID(uuid)
if node.getNodeType() == CLIENT_NODE_TYPE:
if c is t.getConnection():
......
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