From 6e57b0954dfd89a6ed02c678b9c762e81e89d625 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Tue, 26 Feb 2019 15:44:58 +0100 Subject: [PATCH] [FIX] runbot: limit duplicate builds search to one When searching for duplicate builds, a git ls-remote is used to verify that the branch still exists. This command is time consuming (up to 2 seconds). If the number of build is significant, it can last a very long time. When a user push one ore more new branches without new commits, the number of duplicate builds found may be very large (more than 92). This loop blocks the cron wroker in charge of creating new builds. This quick fix will limit the number of duplicate to 1 but if the closest name is not the same, it will not be considered as a duplicate. --- runbot/models/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runbot/models/build.py b/runbot/models/build.py index 95a9350b..07c4b165 100644 --- a/runbot/models/build.py +++ b/runbot/models/build.py @@ -117,7 +117,7 @@ class runbot_build(models.Model): '|', ('result', '=', False), ('result', '!=', 'skipped') ] - for duplicate in self.search(domain): + for duplicate in self.search(domain, limit=1): duplicate_id = duplicate.id # Consider the duplicate if its closest branches are the same than the current build closest branches. for extra_repo in build_id.repo_id.dependency_ids: