From 4ab650cc0e3d243feae718d8e765c20258144145 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Fri, 15 Feb 2008 15:18:07 +0000
Subject: [PATCH] Add logs aound post-business-template-install reindexing, to
 know how long it takes, and how many messages are processed.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19332 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/tests/ERP5TypeTestCase.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py
index 2d18e62aec..42f3ef0cf0 100644
--- a/product/ERP5Type/tests/ERP5TypeTestCase.py
+++ b/product/ERP5Type/tests/ERP5TypeTestCase.py
@@ -676,11 +676,20 @@ def setupERP5Site( business_template_list=(),
 
           portal_activities = getattr(portal, 'portal_activities', None)
           if portal_activities is not None:
+            if not quiet:
+              ZopeTestCase._print('Executing pending activities ... ')
+            start = time.time()
             count = 1000
-            while len(portal_activities.getMessageList()) > 0:
+            message_count = len(portal_activities.getMessageList())
+            while message_count > 0:
               portal_activities.distribute()
               portal_activities.tic()
               get_transaction().commit()
+              new_message_count = len(portal_activities.getMessageList())
+              if new_message_count != message_count:
+                if not quiet:
+                  ZopeTestCase._print('%i ' % (message_count, ))
+                message_count = new_message_count
               count -= 1
               if count == 0:
                 raise RuntimeError, \
@@ -688,6 +697,8 @@ def setupERP5Site( business_template_list=(),
                     [('/'.join(m.object_path), m.method_id,
                      m.processing_node, m.priority)
                      for m in portal_activities.getMessageList()],)
+            if not quiet:
+              ZopeTestCase._print('done (%.3fs)\n' % (time.time() - start))
 
           # Reset aq dynamic, so all unit tests will start again
           _aq_reset()
-- 
2.30.9