From 4b78b96012a1209da24485afb098bed9e8ab0bc7 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Wed, 11 Apr 2007 07:50:16 +0000
Subject: [PATCH] Portal ids will not change between 2 activity store, so
 better do the traversal just once.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14040 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/CMFActivity/Activity/SQLDict.py  | 2 +-
 product/CMFActivity/Activity/SQLQueue.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/product/CMFActivity/Activity/SQLDict.py b/product/CMFActivity/Activity/SQLDict.py
index 68079269f0..cb754a1059 100644
--- a/product/CMFActivity/Activity/SQLDict.py
+++ b/product/CMFActivity/Activity/SQLDict.py
@@ -477,6 +477,7 @@ class SQLDict(RAMDict):
       path_dict = {}
       assignMessage = activity_tool.SQLDict_assignMessage
       processing_node = 1
+      id_tool = activity_tool.getPortalObject().portal_ids
       for message in message_dict.itervalues():
         path = '/'.join(message.object_path)
         broadcast = message.activity_kw.get('broadcast', 0)
@@ -485,7 +486,6 @@ class SQLDict(RAMDict):
           uid = message.uid
           assignMessage(processing_node=1, uid=[uid])
           if node_count > 1:
-            id_tool = activity_tool.getPortalObject().portal_ids
             uid_list = id_tool.generateNewLengthIdList(id_group='portal_activity',
                                                        id_count=node_count - 1)
             path_list = [path] * (node_count - 1)
diff --git a/product/CMFActivity/Activity/SQLQueue.py b/product/CMFActivity/Activity/SQLQueue.py
index e1317dfb5c..27021ac648 100644
--- a/product/CMFActivity/Activity/SQLQueue.py
+++ b/product/CMFActivity/Activity/SQLQueue.py
@@ -321,6 +321,7 @@ class SQLQueue(RAMQueue):
       path_dict = {}
       assignMessage = activity_tool.SQLQueue_assignMessage
       processing_node = 1
+      id_tool = activity_tool.getPortalObject().portal_ids
       for message in message_dict.itervalues():
         path = '/'.join(message.object_path)
         broadcast = message.activity_kw.get('broadcast', 0)
@@ -328,7 +329,6 @@ class SQLQueue(RAMQueue):
           # Broadcast messages must be distributed into all nodes.
           assignMessage(processing_node=1, uid=message.uid)
           if node_count > 1:
-            id_tool = activity_tool.getPortalObject().portal_ids
             uid_list = id_tool.generateNewLengthIdList(id_group='portal_activity_queue',
                                                        id_count=node_count - 1)
             priority = message.activity_kw.get('priority', 1)
-- 
2.30.9