From a0251f1b68311e7398409fc93a3ffb88d04977f7 Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Thu, 28 Nov 2024 11:24:31 +0100 Subject: [PATCH] [IMP] runbot: faster batch prepare --- runbot/models/repo.py | 1 + runbot/tests/test_build.py | 3 +++ runbot/tests/test_repo.py | 3 +++ 3 files changed, 7 insertions(+) diff --git a/runbot/models/repo.py b/runbot/models/repo.py index 87bf3e8c..d51fa1d0 100644 --- a/runbot/models/repo.py +++ b/runbot/models/repo.py @@ -632,6 +632,7 @@ class Repo(models.Model): 'state': 'preparing', }) bundle.last_batch = preparing + preparing._process() # process in case we have a 0 wait on project if bundle.last_batch.state == 'preparing': bundle.last_batch._new_commit(branch) diff --git a/runbot/tests/test_build.py b/runbot/tests/test_build.py index d05a45a5..eb85df11 100644 --- a/runbot/tests/test_build.py +++ b/runbot/tests/test_build.py @@ -104,6 +104,7 @@ class TestBuildParams(RunbotCaseMinimalSetup): branch_a_name = 'master-test-something' self.push_commit(self.remote_server_dev, branch_a_name, 'nice subject', sha='d0d0caca') # batch preparation + self.repo_server.project_id.process_delay = 10 self.repo_server._update_batches() # create a custom config and a new trigger @@ -118,6 +119,8 @@ class TestBuildParams(RunbotCaseMinimalSetup): 'bundle_id': bundle.id, 'config_id': custom_config.id }) + + self.repo_server.project_id.process_delay = 0 bundle.last_batch._process() 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) diff --git a/runbot/tests/test_repo.py b/runbot/tests/test_repo.py index 56dccccb..f56040ee 100644 --- a/runbot/tests/test_repo.py +++ b/runbot/tests/test_repo.py @@ -86,6 +86,7 @@ class TestRepo(RunbotCaseMinimalSetup): self.commit_list[self.repo_server.id] = first_commit self.patchers['github_patcher'].side_effect = github + self.repo_server.project_id.process_delay = 10 repos._update_batches() dev_branch = self.env['runbot.branch'].search([('remote_id', '=', self.remote_server_dev.id)]) @@ -252,6 +253,8 @@ class TestRepo(RunbotCaseMinimalSetup): return {} self.patchers['github_patcher'].side_effect = github2 + + self.repo_server.project_id.process_delay = 0 bundle.last_batch._process() self.assertEqual(last_batch.commit_link_ids.commit_id.mapped('subject'), ['Server subject', 'Addons subject'])