[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.
This commit is contained in:
Christophe Monniez 2019-03-15 08:08:22 +01:00
parent 64694a6b0b
commit f50b13172d

View File

@ -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):