[IMP] runbot: avoid concurrent write and useless still in use messages

This commit is contained in:
Xavier-Do 2021-11-29 11:50:16 +01:00 committed by Christophe Monniez
parent 0b30b9c104
commit e22c403102

View File

@ -83,11 +83,14 @@ class Batch(models.Model):
for slot in batch.slot_ids: for slot in batch.slot_ids:
slot.skipped = True slot.skipped = True
build = slot.build_id build = slot.build_id
if build.global_state in ('running', 'done'):
continue
testing_slots = build.slot_ids.filtered(lambda s: not s.skipped) testing_slots = build.slot_ids.filtered(lambda s: not s.skipped)
if not testing_slots: if not testing_slots:
if build.global_state == 'pending': if build.global_state == 'pending':
build._skip('Newer build found') build._skip('Newer build found')
elif build.global_state in ('waiting', 'testing'): elif build.global_state in ('waiting', 'testing'):
if not build.killable:
build.killable = True build.killable = True
elif slot.link_type == 'created': elif slot.link_type == 'created':
batches = testing_slots.mapped('batch_id') batches = testing_slots.mapped('batch_id')
@ -117,6 +120,7 @@ class Batch(models.Model):
build = self.env['runbot.build'].search([('params_id', '=', params.id), ('parent_id', '=', False)], limit=1, order='id desc') build = self.env['runbot.build'].search([('params_id', '=', params.id), ('parent_id', '=', False)], limit=1, order='id desc')
link_type = 'matched' link_type = 'matched'
if build: if build:
if build.killable:
build.killable = False build.killable = False
else: else:
description = params.trigger_id.description if params.trigger_id.description else False description = params.trigger_id.description if params.trigger_id.description else False