# HG changeset patch # User Mads Kiilerich # Date 2014-07-18 18:44:54 # Node ID fb3b45acd1721a2c0d22f482db06ab6e2b23df5b # Parent cdb2b5ac95e657db3f72178bed49a0441ecdd5b3 repository: don't update changeset cache so much - not in BaseRepoController and only when tip raw_id changed diff --git a/kallithea/lib/base.py b/kallithea/lib/base.py --- a/kallithea/lib/base.py +++ b/kallithea/lib/base.py @@ -411,9 +411,6 @@ class BaseRepoController(BaseController) redirect(url('home')) - # update last change according to VCS data - dbr.update_changeset_cache(dbr.get_changeset()) - # some globals counter for menu c.repository_followers = self.scm_model.get_followers(dbr) c.repository_forks = self.scm_model.get_forks(dbr) diff --git a/kallithea/model/db.py b/kallithea/model/db.py --- a/kallithea/model/db.py +++ b/kallithea/model/db.py @@ -1321,7 +1321,7 @@ class Repository(Base, BaseModel): if isinstance(cs_cache, BaseChangeset): cs_cache = cs_cache.__json__() - if (cs_cache != self.changeset_cache or not self.changeset_cache): + if (not self.changeset_cache or cs_cache['raw_id'] != self.changeset_cache['raw_id']): _default = datetime.datetime.fromtimestamp(0) last_change = cs_cache.get('date') or _default log.debug('updated repo %s with new cs cache %s' @@ -1331,8 +1331,8 @@ class Repository(Base, BaseModel): Session().add(self) Session().commit() else: - log.debug('Skipping repo:%s already with latest changes' - % self.repo_name) + log.debug('changeset_cache for %s already up to date with %s' + % (self.repo_name, cs_cache['raw_id'])) @property def tip(self):