# HG changeset patch # User Mads Kiilerich # Date 1582565851 -3600 # Node ID e432a6a7dd7cd354ae699f89dfa3d8335e0dd6cf # Parent b2f7d1c4e0017b68255ca63078c273dddc1460ec celery: move initialization of global kallithea.CELERY_EAGER to the place where we read celery configuration Prepare for backwards compatibility after the name change with Celery 4. diff -r b2f7d1c4e001 -r e432a6a7dd7c kallithea/config/app_cfg.py --- a/kallithea/config/app_cfg.py Mon Feb 24 17:51:17 2020 +0100 +++ b/kallithea/config/app_cfg.py Mon Feb 24 18:37:31 2020 +0100 @@ -161,7 +161,6 @@ # 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 -r b2f7d1c4e001 -r e432a6a7dd7c kallithea/lib/celerypylons/__init__.py --- a/kallithea/lib/celerypylons/__init__.py Mon Feb 24 17:51:17 2020 +0100 +++ b/kallithea/lib/celerypylons/__init__.py Mon Feb 24 18:37:31 2020 +0100 @@ -19,12 +19,15 @@ 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 @@ 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 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