# HG changeset patch # User Marcin Kuzminski # Date 2018-06-21 16:14:30 # Node ID 24d6ff87dabbd8764bf1364184e0ee311e24f53e # Parent 0d542a40fd31588293f6d1c73ac0155130cb6cbc last-update: use smarter calculation that picks the newer dates first instead of relying dumply on last commit date which in some cases might be very very old. diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -2231,8 +2231,13 @@ class Repository(Base, BaseModel): # check if we have maybe already latest cached revision if is_outdated(cs_cache) or not self.changeset_cache: - _default = datetime.datetime.fromtimestamp(0) + _default = datetime.datetime.utcnow() last_change = cs_cache.get('date') or _default + if self.updated_on and self.updated_on > last_change: + # we check if last update is newer than the new value + # if yes, we use the current timestamp instead. Imagine you get + # old commit pushed 1y ago, we'd set last update 1y to ago. + last_change = _default log.debug('updated repo %s with new cs cache %s', self.repo_name, cs_cache) self.updated_on = last_change