mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[FIX] runbot_merge: set staging_end on all terminations
Rather than only setting `staging_end` on status change, set it when the staging gets deactivated. This way cancelling a staging (whether explicitely or via a PR update) will also end it, so will a staging timeout, etc..., rather than keep the counter running. Fixes #931
This commit is contained in:
parent
64f9dcbc22
commit
146564a90a
@ -2049,6 +2049,7 @@ class Stagings(models.Model):
|
||||
._trigger(fields.Datetime.to_datetime(timeout))
|
||||
|
||||
if vals.get('active') is False:
|
||||
vals['staging_end'] = fields.Datetime.now()
|
||||
self.env.ref("runbot_merge.staging_cron")._trigger()
|
||||
|
||||
return super().write(vals)
|
||||
@ -2141,7 +2142,6 @@ class Stagings(models.Model):
|
||||
s.state = st
|
||||
if s.state != 'pending':
|
||||
self.env.ref("runbot_merge.merge_cron")._trigger()
|
||||
s.staging_end = fields.Datetime.now()
|
||||
if update_timeout_limit:
|
||||
s.timeout_limit = datetime.datetime.now() + datetime.timedelta(minutes=s.target.project_id.ci_timeout)
|
||||
self.env.ref("runbot_merge.merge_cron")._trigger(s.timeout_limit)
|
||||
|
Loading…
Reference in New Issue
Block a user