# HG changeset patch # User Marcin Kuzminski # Date 2013-01-26 22:11:40 # Node ID 21cccfea18bf6229d8e02b665125a3423a6b40a0 # Parent 11b005b2d5e82927075b275390a566ad58c1cb3c Return a list of invlidated keys on mark_for_invalidation func - log.debug list of invalidated keys diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -1653,22 +1653,25 @@ class CacheInvalidation(Base, BaseModel) :param key: """ + invalidated_keys = [] if key: key, _prefix, _org_key = cls._get_key(key) inv_objs = Session().query(cls).filter(cls.cache_key == key).all() elif repo_name: inv_objs = Session().query(cls).filter(cls.cache_args == repo_name).all() - log.debug('marking %s key[s] for invalidation based on key=%s,repo_name=%s' - % (len(inv_objs), key, repo_name)) try: for inv_obj in inv_objs: inv_obj.cache_active = False + log.debug('marking %s key for invalidation based on key=%s,repo_name=%s' + % (inv_obj, key, repo_name)) + invalidated_keys.append(inv_obj.cache_key) Session().add(inv_obj) Session().commit() except Exception: log.error(traceback.format_exc()) Session().rollback() + return invalidated_keys @classmethod def set_valid(cls, key): diff --git a/rhodecode/model/scm.py b/rhodecode/model/scm.py --- a/rhodecode/model/scm.py +++ b/rhodecode/model/scm.py @@ -301,10 +301,11 @@ class ScmModel(BaseModel): :param repo_name: this repo that should invalidation take place """ - CacheInvalidation.set_invalidate(repo_name=repo_name) + invalidated_keys = CacheInvalidation.set_invalidate(repo_name=repo_name) repo = Repository.get_by_repo_name(repo_name) if repo: repo.update_changeset_cache() + return invalidated_keys def toggle_following_repo(self, follow_repo_id, user_id):