From 1d0dfd4130d7bc463e61d103e223e91a71875e02 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Wed, 13 Aug 2008 14:51:39 +0000
Subject: [PATCH] Disable activity creation-time traceack by default to fix
 performance tests failing on object creation (~+40% increase !).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22983 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/CMFActivity/ActivityTool.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/product/CMFActivity/ActivityTool.py b/product/CMFActivity/ActivityTool.py
index 6546cc2c09..3f32f57f44 100644
--- a/product/CMFActivity/ActivityTool.py
+++ b/product/CMFActivity/ActivityTool.py
@@ -97,6 +97,16 @@ def disableLogging():
   global logging
   logging = False
 
+activity_creation_trace = False
+
+def enableActivityCreationTrace():
+  global activity_creation_trace
+  activity_creation_trace = True
+
+def disableActivityCreationTrace():
+  global activity_creation_trace
+  activity_creation_trace = false
+
 # Here go ActivityBuffer instances
 # Structure:
 #  global_activity_buffer[activity_tool_path][thread_id] = ActivityBuffer
@@ -143,13 +153,13 @@ class Message:
     self.exc_type = None
     self.exc_value = None
     self.traceback = None
-    if format_list is None:
-      self.call_traceback = None
-    else:
+    if activity_creation_trace and format_list is not None:
       # Save current traceback, to make it possible to tell where a message
       # was generated.
       # Strip last stack entry, since it will always be the same.
       self.call_traceback = ''.join(format_list(extract_stack()[:-1]))
+    else:
+      self.call_traceback = None
     self.processing = None
     self.user_name = str(_getAuthenticatedUser(self))
     # Store REQUEST Info
-- 
2.30.9