From e6a1a0634a47fa3cd4fa8a6f1386009d0982c433 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 21 Sep 2018 15:57:16 +0200 Subject: [PATCH] [FIX] runbot_merge: re-enable staging delay staging delay was mistakenly commented in bb664455ec5b0a3f1d1f03b8827e78357cd61800 Also modified testing fixtures so the staging delay is not enabled when running tests locally: on my box it increases the local runtime from ~70s to ~1500s (20s/staging, ~1 staging/test, 73 tests) --- runbot_merge/models/pull_requests.py | 8 ++++---- runbot_merge/tests/local.py | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/runbot_merge/models/pull_requests.py b/runbot_merge/models/pull_requests.py index 9dcfbed9..93edeb12 100644 --- a/runbot_merge/models/pull_requests.py +++ b/runbot_merge/models/pull_requests.py @@ -15,6 +15,9 @@ from odoo.exceptions import ValidationError from .. import github, exceptions, controllers +STAGING_SLEEP = 20 +"temp hack: add a delay between staging repositories in case there's a race when quickly pushing a repo then its dependency" + _logger = logging.getLogger(__name__) class Project(models.Model): _name = 'runbot_merge.project' @@ -211,10 +214,7 @@ class Project(models.Model): heads[r.name] ) it['gh'].set_ref('staging.{}'.format(branch.name), heads[r.name]) - # temp hack: add a delay between staging repositories - # in case there's a race when quickly pushing a repo - # then its dependency - # time.sleep(20) + time.sleep(STAGING_SLEEP) # creating the staging doesn't trigger a write on the prs # and thus the ->staging taggings, so do that by hand diff --git a/runbot_merge/tests/local.py b/runbot_merge/tests/local.py index da3c2f08..5d315bae 100644 --- a/runbot_merge/tests/local.py +++ b/runbot_merge/tests/local.py @@ -31,6 +31,8 @@ def registry(request): [mod] = env['ir.module.module'].search([('name', '=', 'runbot_merge')]) mod.button_immediate_install() + from odoo.addons.runbot_merge.models import pull_requests + pull_requests.STAGING_SLEEP = 0 yield odoo.registry(db) @pytest.fixture