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): ...@@ -572,14 +572,12 @@ class Application(object):
if transaction is not local_var.txn: if transaction is not local_var.txn:
raise StorageTransactionError(self, transaction) raise StorageTransactionError(self, transaction)
tid = local_var.tid 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 # Store data on each node
voted_counter = 0 voted_counter = 0
cell_list = self._getCellListForTID(tid, writable=True) p = Packets.AskStoreTransaction(tid, transaction.user,
for cell in cell_list: 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(), logging.debug("voting object %s %s" %(cell.getAddress(),
cell.getState())) cell.getState()))
conn = self.cp.getConnForCell(cell) conn = self.cp.getConnForCell(cell)
...@@ -587,8 +585,6 @@ class Application(object): ...@@ -587,8 +585,6 @@ class Application(object):
continue continue
local_var.txn_voted = False local_var.txn_voted = False
p = Packets.AskStoreTransaction(tid,
user, desc, ext, oid_list)
try: try:
self._askStorage(conn, p) self._askStorage(conn, p)
except ConnectionClosed: 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