You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by gj...@apache.org on 2014/07/19 19:07:49 UTC

svn commit: r1611921 - in /bloodhound/trunk/bloodhound_multiproduct/multiproduct: env.py hooks.py

Author: gjm
Date: Sat Jul 19 17:07:48 2014
New Revision: 1611921

URL: http://svn.apache.org/r1611921
Log:
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

Modified:
    bloodhound/trunk/bloodhound_multiproduct/multiproduct/env.py
    bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py

Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/env.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/env.py?rev=1611921&r1=1611920&r2=1611921&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_multiproduct/multiproduct/env.py (original)
+++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/env.py Sat Jul 19 17:07:48 2014
@@ -365,6 +365,8 @@ class ProductEnvironment(Component, Comp
                 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 @@ class ProductEnvironment(Component, Comp
     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 [

Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py?rev=1611921&r1=1611920&r2=1611921&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py (original)
+++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py Sat Jul 19 17:07:48 2014
@@ -37,6 +37,8 @@ PRODUCT_RE = re.compile(r'^/products(?:/
 
 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



Re: svn commit: r1611921 - in /bloodhound/trunk/bloodhound_multiproduct/multiproduct: env.py hooks.py

Posted by Gary Martin <ga...@wandisco.com>.
Hi,

Just committed what I hope is a fix for a caching issue that shows up in
situations like adding and removing milestones for the default webserver
configuration we advise.

Prior to this I added a test case to carefully demonstrate the issue.
Unfortunately the fix I have here does nothing to make the test pass and
instead it just makes sure that the cache is cleared at the beginning of
each request.

Cheers,
    Gary


On 19/07/14 18:07, gjm@apache.org wrote:
> Author: gjm
> Date: Sat Jul 19 17:07:48 2014
> New Revision: 1611921
>
> URL: http://svn.apache.org/r1611921
> Log:
> 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
>
> Modified:
>     bloodhound/trunk/bloodhound_multiproduct/multiproduct/env.py
>     bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py
>
> Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/env.py
> URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/env.py?rev=1611921&r1=1611920&r2=1611921&view=diff
> ==============================================================================
> --- bloodhound/trunk/bloodhound_multiproduct/multiproduct/env.py (original)
> +++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/env.py Sat Jul 19 17:07:48 2014
> @@ -365,6 +365,8 @@ class ProductEnvironment(Component, Comp
>                  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 @@ class ProductEnvironment(Component, Comp
>      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 [
>
> Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py
> URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py?rev=1611921&r1=1611920&r2=1611921&view=diff
> ==============================================================================
> --- bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py (original)
> +++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py Sat Jul 19 17:07:48 2014
> @@ -37,6 +37,8 @@ PRODUCT_RE = re.compile(r'^/products(?:/
>  
>  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
>
>