# HG changeset patch # User Daniel Dourvaris # Date 2016-08-10 23:08:54 # Node ID 4d980275122d7961c1b74a24dd55bc3317261e11 # Parent 84e47054a60d56b931a86d9c70ea00b258b4f38e celery: Reorder celery imports to fix case where celery tasks were being registered before celery config was setup. Added comments to make this clear so we don't chase this problem in the future until it is refactored diff --git a/rhodecode/config/environment.py b/rhodecode/config/environment.py --- a/rhodecode/config/environment.py +++ b/rhodecode/config/environment.py @@ -34,11 +34,16 @@ from pylons.configuration import PylonsC from pylons.error import handle_mako_error from pyramid.settings import asbool -# don't remove this import it does magic for celery -from rhodecode.lib import celerypylons # noqa +# ------------------------------------------------------------------------------ +# CELERY magic until refactor - issue #4163 - import order matters here: +from rhodecode.lib import celerypylons # this must be first, celerypylons + # sets config settings upon import -import rhodecode.lib.app_globals as app_globals +import rhodecode.integrations # any modules using celery task + # decorators should be added afterwards: +# ------------------------------------------------------------------------------ +from rhodecode.lib import app_globals from rhodecode.config import utils from rhodecode.config.routing import make_map from rhodecode.config.jsroutes import generate_jsroutes_content diff --git a/rhodecode/config/middleware.py b/rhodecode/config/middleware.py --- a/rhodecode/config/middleware.py +++ b/rhodecode/config/middleware.py @@ -39,7 +39,6 @@ from routes.middleware import RoutesMidd import routes.util import rhodecode -import rhodecode.integrations # do not remove this as it registers celery tasks from rhodecode.config import patches from rhodecode.config.routing import STATIC_FILE_PREFIX from rhodecode.config.environment import (