diff --git a/conf/config.py b/conf/config.py index e5212c57..bb9ef013 100644 --- a/conf/config.py +++ b/conf/config.py @@ -109,8 +109,8 @@ class TestConfiguration(BaseConfiguration): NET_TIMEOUT = 3 NET_RETRY_INTERVAL = 1 # SCM network-related values, in seconds - SCM_NET_TIMEOUT = 3 - SCM_NET_RETRY_INTERVAL = 1 + SCM_NET_TIMEOUT = 0.1 + SCM_NET_RETRY_INTERVAL = 0.1 KOJI_CONFIG = './conf/koji.conf' KOJI_PROFILE = 'staging' diff --git a/module_build_service/scheduler/handlers/modules.py b/module_build_service/scheduler/handlers/modules.py index 3d4b1313..1714d162 100644 --- a/module_build_service/scheduler/handlers/modules.py +++ b/module_build_service/scheduler/handlers/modules.py @@ -136,8 +136,11 @@ def init(config, session, msg): """ Called whenever a module enters the 'init' state.""" # Sleep for a few seconds to make sure the module in the database is committed # TODO: Remove this once messaging is implemented in SQLAlchemy hooks - time.sleep(3) - build = models.ModuleBuild.from_module_event(session, msg) + for i in range(3): + build = models.ModuleBuild.from_module_event(session, msg) + if build: + break + time.sleep(1) try: mmd = build.mmd() diff --git a/module_build_service/utils.py b/module_build_service/utils.py index 09827ec9..7c511164 100644 --- a/module_build_service/utils.py +++ b/module_build_service/utils.py @@ -62,14 +62,14 @@ def retry(timeout=conf.net_timeout, interval=conf.net_retry_interval, wait_on=Ex def inner(*args, **kwargs): start = time.time() while True: - if (time.time() - start) >= timeout: - raise # This re-raises the last exception. try: return function(*args, **kwargs) except wait_on as e: log.warn("Exception %r raised from %r. Retry in %rs" % ( e, function, interval)) time.sleep(interval) + if (time.time() - start) >= timeout: + raise # This re-raises the last exception. return inner return wrapper