From f50b13172dc57b849cdb8ab1de29a0a479b309c4 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Fri, 15 Mar 2019 08:08:22 +0100 Subject: [PATCH] [FIX] runbot: ivalidate cache to get valid hook_time When github reaches the hook controller, the repo hook_time field is updated. That way, a git fetch is done only when the hook_time is newer that the last fetch. If the hook_time is updated during the long running cron that runs the _cron_fetch_and_schedule method, the hook_time is cached and only the old hook time is seen until the cron's end. The cursor commit is not enough. As a result, the new builds are scheduled in the next cron run. With this commit, the cache is invalidated after the commit, that way, the hook_time field contains the correct value. --- runbot/models/repo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/runbot/models/repo.py b/runbot/models/repo.py index d07570c4..87274db0 100644 --- a/runbot/models/repo.py +++ b/runbot/models/repo.py @@ -383,6 +383,7 @@ class runbot_repo(models.Model): self._update(repos, force=False) self._create_pending_builds(repos) self.env.cr.commit() + self.invalidate_cache() time.sleep(update_frequency) def _cron_fetch_and_build(self, hostname):