diff --git a/kallithea/config/app_cfg.py b/kallithea/config/app_cfg.py --- a/kallithea/config/app_cfg.py +++ b/kallithea/config/app_cfg.py @@ -161,7 +161,6 @@ def setup_configuration(app): # store some globals into kallithea if str2bool(config.get('use_celery')): kallithea.CELERY_APP = celerypylons.make_app() - kallithea.CELERY_EAGER = str2bool(config.get('celery.always.eager')) kallithea.CONFIG = config load_rcextensions(root_path=config['here']) diff --git a/kallithea/lib/celerypylons/__init__.py b/kallithea/lib/celerypylons/__init__.py --- a/kallithea/lib/celerypylons/__init__.py +++ b/kallithea/lib/celerypylons/__init__.py @@ -19,12 +19,15 @@ import logging import celery import tg +import kallithea + class CeleryConfig(object): CELERY_IMPORTS = ['kallithea.lib.celerylib.tasks'] CELERY_ACCEPT_CONTENT = ['json'] CELERY_RESULT_SERIALIZER = 'json' CELERY_TASK_SERIALIZER = 'json' + CELERY_ALWAYS_EAGER = False desupported = set([ @@ -37,7 +40,7 @@ desupported = set([ log = logging.getLogger(__name__) -def celery_config(config): +def make_celery_config(config): """Return Celery config object populated from relevant settings in a config dict, such as tg.config""" celery_config = CeleryConfig() @@ -68,5 +71,7 @@ def celery_config(config): def make_app(): """Create celery app from the TurboGears configuration file""" app = celery.Celery() - app.config_from_object(celery_config(tg.config)) + celery_config = make_celery_config(tg.config) + kallithea.CELERY_EAGER = celery_config.CELERY_ALWAYS_EAGER + app.config_from_object(celery_config) return app