[IMP] runbot: faster batch prepare

This commit is contained in:
Xavier-Do 2024-11-28 11:24:31 +01:00 committed by xdo
parent 0beb2cd71b
commit b76a523730
3 changed files with 7 additions and 0 deletions

View File

@ -632,6 +632,7 @@ class Repo(models.Model):
'state': 'preparing', 'state': 'preparing',
}) })
bundle.last_batch = preparing bundle.last_batch = preparing
preparing._process() # process in case we have a 0 wait on project
if bundle.last_batch.state == 'preparing': if bundle.last_batch.state == 'preparing':
bundle.last_batch._new_commit(branch) bundle.last_batch._new_commit(branch)

View File

@ -104,6 +104,7 @@ class TestBuildParams(RunbotCaseMinimalSetup):
branch_a_name = 'master-test-something' branch_a_name = 'master-test-something'
self.push_commit(self.remote_server_dev, branch_a_name, 'nice subject', sha='d0d0caca') self.push_commit(self.remote_server_dev, branch_a_name, 'nice subject', sha='d0d0caca')
# batch preparation # batch preparation
self.repo_server.project_id.process_delay = 10
self.repo_server._update_batches() self.repo_server._update_batches()
# create a custom config and a new trigger # create a custom config and a new trigger
@ -118,6 +119,8 @@ class TestBuildParams(RunbotCaseMinimalSetup):
'bundle_id': bundle.id, 'bundle_id': bundle.id,
'config_id': custom_config.id 'config_id': custom_config.id
}) })
self.repo_server.project_id.process_delay = 0
bundle.last_batch._process() bundle.last_batch._process()
build_slot = bundle.last_batch.slot_ids.filtered(lambda rec: rec.trigger_id == self.trigger_server) build_slot = bundle.last_batch.slot_ids.filtered(lambda rec: rec.trigger_id == self.trigger_server)
self.assertEqual(build_slot.build_id.params_id.config_id, custom_config) self.assertEqual(build_slot.build_id.params_id.config_id, custom_config)

View File

@ -86,6 +86,7 @@ class TestRepo(RunbotCaseMinimalSetup):
self.commit_list[self.repo_server.id] = first_commit self.commit_list[self.repo_server.id] = first_commit
self.patchers['github_patcher'].side_effect = github self.patchers['github_patcher'].side_effect = github
self.repo_server.project_id.process_delay = 10
repos._update_batches() repos._update_batches()
dev_branch = self.env['runbot.branch'].search([('remote_id', '=', self.remote_server_dev.id)]) dev_branch = self.env['runbot.branch'].search([('remote_id', '=', self.remote_server_dev.id)])
@ -252,6 +253,8 @@ class TestRepo(RunbotCaseMinimalSetup):
return {} return {}
self.patchers['github_patcher'].side_effect = github2 self.patchers['github_patcher'].side_effect = github2
self.repo_server.project_id.process_delay = 0
bundle.last_batch._process() bundle.last_batch._process()
self.assertEqual(last_batch.commit_link_ids.commit_id.mapped('subject'), ['Server subject', 'Addons subject']) self.assertEqual(last_batch.commit_link_ids.commit_id.mapped('subject'), ['Server subject', 'Addons subject'])