From a9bf4e972796ee46bd2e18c4f11f5b99f7820f5c Mon Sep 17 00:00:00 2001 From: mprahl Date: Thu, 12 Oct 2017 17:13:03 -0400 Subject: [PATCH] Add a sleep in the init handler to protect against a race condition --- module_build_service/scheduler/handlers/modules.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module_build_service/scheduler/handlers/modules.py b/module_build_service/scheduler/handlers/modules.py index e4017d29..e168d2ce 100644 --- a/module_build_service/scheduler/handlers/modules.py +++ b/module_build_service/scheduler/handlers/modules.py @@ -41,6 +41,7 @@ import koji import logging import os +import time logging.basicConfig(level=logging.DEBUG) @@ -126,6 +127,9 @@ def done(config, session, msg): 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) try: