Commit 423eb067 authored by Vincent Pelletier's avatar Vincent Pelletier

Move packet construction outside of loop as it uses only loop invariants.

Also, avoid using local variables when they are used just once.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1766 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 8ee92ac4
......@@ -572,14 +572,12 @@ class Application(object):
if transaction is not local_var.txn:
raise StorageTransactionError(self, transaction)
tid = local_var.tid
user = transaction.user
desc = transaction.description
ext = dumps(transaction._extension)
oid_list = self.local_var.data_dict.keys()
# Store data on each node
voted_counter = 0
cell_list = self._getCellListForTID(tid, writable=True)
for cell in cell_list:
p = Packets.AskStoreTransaction(tid, transaction.user,
transaction.description, dumps(transaction._extension),
local_var.data_dict.keys())
for cell in self._getCellListForTID(tid, writable=True):
logging.debug("voting object %s %s" %(cell.getAddress(),
cell.getState()))
conn = self.cp.getConnForCell(cell)
......@@ -587,8 +585,6 @@ class Application(object):
continue
local_var.txn_voted = False
p = Packets.AskStoreTransaction(tid,
user, desc, ext, oid_list)
try:
self._askStorage(conn, p)
except ConnectionClosed:
......
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