diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -1977,7 +1977,7 @@ class Repository(Base, BaseModel): return self._get_instance() invalidator_context = CacheKey.repo_context_cache( - _get_repo, self.repo_name, None) + _get_repo, self.repo_name, None, thread_scoped=True) with invalidator_context as context: context.invalidate() @@ -2848,7 +2848,8 @@ class CacheKey(Base, BaseModel): return None @classmethod - def repo_context_cache(cls, compute_func, repo_name, cache_type): + def repo_context_cache(cls, compute_func, repo_name, cache_type, + thread_scoped=False): """ @cache_region('long_term') def _heavy_calculation(cache_key): @@ -2864,7 +2865,8 @@ class CacheKey(Base, BaseModel): assert computed == 'result' """ from rhodecode.lib import caches - return caches.InvalidationContext(compute_func, repo_name, cache_type) + return caches.InvalidationContext( + compute_func, repo_name, cache_type, thread_scoped=thread_scoped) class ChangesetComment(Base, BaseModel):