# HG changeset patch # User Mads Kiilerich # Date 1457448654 -3600 # Node ID b45fb7a3d03badc39b9ef9ed9451ab33768d8f09 # Parent b5bef0b3920976bd0423b44de2d053c5160aab2a db: minor changes for repo caching diff -r b5bef0b39209 -r b45fb7a3d03b kallithea/lib/utils.py --- a/kallithea/lib/utils.py Wed Mar 02 16:21:11 2016 +0100 +++ b/kallithea/lib/utils.py Tue Mar 08 15:50:54 2016 +0100 @@ -857,7 +857,7 @@ return data # denpending from condition the compute is wrapped in cache or not - compute = conditional_cache('short_term', 'cache_desc', codnition=True, func=func) + compute = conditional_cache('short_term', 'cache_desc', condition=True, func=func) return compute(arg) :param region: name of cache region diff -r b5bef0b39209 -r b45fb7a3d03b kallithea/model/db.py --- a/kallithea/model/db.py Wed Mar 02 16:21:11 2016 +0100 +++ b/kallithea/model/db.py Tue Mar 08 15:50:54 2016 +0100 @@ -1450,7 +1450,8 @@ def scm_instance_cached(self, valid_cache_keys=None): @cache_region('long_term') - def _c(repo_name): + def _c(repo_name): # repo_name is just for the cache key + log.debug('Creating new %s scm_instance and populating cache', repo_name) return self.__get_instance() rn = self.repo_name @@ -1459,7 +1460,7 @@ log.debug('Cache for %s invalidated, getting new object', rn) region_invalidate(_c, None, rn) else: - log.debug('Getting scm_instance of %s from cache', rn) + log.debug('Trying to get scm_instance of %s from cache', rn) return _c(rn) def __get_instance(self): @@ -2133,7 +2134,7 @@ inv_obj = cls.query().filter(cls.cache_key == cache_key).scalar() if inv_obj is None: - inv_obj = CacheInvalidation(cache_key, repo_name) + inv_obj = cls(cache_key, repo_name) elif inv_obj.cache_active: return True inv_obj.cache_active = True