clearing the lru_cache close to the beginning of a request to limit impact of caching errors in multi process/threaded web serving - towards #613
git-svn-id: https://svn.apache.org/repos/asf/bloodhound/trunk@1611921 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bloodhound_multiproduct/multiproduct/env.py b/bloodhound_multiproduct/multiproduct/env.py
index 87db30b..23a0b6d 100644
--- a/bloodhound_multiproduct/multiproduct/env.py
+++ b/bloodhound_multiproduct/multiproduct/env.py
@@ -365,6 +365,8 @@
g_env = env.parent if isinstance(env,
ProductEnvironment) else env
return f(self, g_env, *args, **kwargs)
+ __call__.clear = f.clear
+
return __call__
def product_env_keymap(args, kwds, kwd_mark):
@@ -397,6 +399,10 @@
setup_participants = ExtensionPoint(trac.env.IEnvironmentSetupParticipant)
multi_product_support_components = ExtensionPoint(ISupportMultiProductEnvironment)
+ @classmethod
+ def clear_env_cache(cls):
+ cls.__metaclass__.__call__.clear()
+
@property
def product_setup_participants(self):
return [
diff --git a/bloodhound_multiproduct/multiproduct/hooks.py b/bloodhound_multiproduct/multiproduct/hooks.py
index a39571e..855a5ca 100644
--- a/bloodhound_multiproduct/multiproduct/hooks.py
+++ b/bloodhound_multiproduct/multiproduct/hooks.py
@@ -37,6 +37,8 @@
class MultiProductEnvironmentFactory(EnvironmentFactoryBase):
def open_environment(self, environ, env_path, global_env, use_cache=False):
+ # clearing product environment cache - bh:ticket:613
+ multiproduct.env.ProductEnvironment.clear_env_cache()
environ.setdefault('SCRIPT_NAME', '') # bh:ticket:594
env = pid = product_path = None