mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] forwardport: avoid locking cron when a _validate blows up
If a _validate call blows up, the entire Commit._notify cron gets stuck, which is an issue because not only does it stop creating forward ports, it also stops "progressing" stagings.
This commit is contained in:
parent
7659293a2b
commit
eb9eeb670a
@ -1263,18 +1263,20 @@ class Commit(models.Model):
|
||||
PRs = self.env['runbot_merge.pull_requests']
|
||||
# chances are low that we'll have more than one commit
|
||||
for c in self.search([('to_check', '=', True)]):
|
||||
c.to_check = False
|
||||
st = json.loads(c.statuses)
|
||||
pr = PRs.search([('head', '=', c.sha)])
|
||||
if pr:
|
||||
pr._validate(st)
|
||||
# heads is a json-encoded mapping of reponame:head, so chances
|
||||
# are if a sha matches a heads it's matching one of the shas
|
||||
stagings = Stagings.search([('heads', 'ilike', c.sha)])
|
||||
if stagings:
|
||||
stagings._validate()
|
||||
|
||||
self.env.cr.commit()
|
||||
try:
|
||||
with self.env.cr:
|
||||
c.to_check = False
|
||||
st = json.loads(c.statuses)
|
||||
pr = PRs.search([('head', '=', c.sha)])
|
||||
if pr:
|
||||
pr._validate(st)
|
||||
# heads is a json-encoded mapping of reponame:head, so chances
|
||||
# are if a sha matches a heads it's matching one of the shas
|
||||
stagings = Stagings.search([('heads', 'ilike', c.sha)])
|
||||
if stagings:
|
||||
stagings._validate()
|
||||
except Exception:
|
||||
_logger.exception("Failed to apply commit %s (%s)", c, c.sha)
|
||||
|
||||
_sql_constraints = [
|
||||
('unique_sha', 'unique (sha)', 'no duplicated commit'),
|
||||
|
Loading…
Reference in New Issue
Block a user