# HG changeset patch # User Mads Kiilerich # Date 1604685476 -3600 # Node ID aa8680af29c252040edca97962e887476292e451 # Parent 488a1fa637a0b747e80e9b5643d4ad58dd3c240e celery: drop kallithea.CELERY_EAGER - it is more spot-on to look directly at task_always_eager The global flag was set as a side effect in the make_app function. That's not pretty. diff -r 488a1fa637a0 -r aa8680af29c2 kallithea/__init__.py --- a/kallithea/__init__.py Sat Nov 07 18:49:57 2020 +0100 +++ b/kallithea/__init__.py Fri Nov 06 18:57:56 2020 +0100 @@ -41,7 +41,6 @@ } CELERY_APP = None # set to Celery app instance if using Celery -CELERY_EAGER = False CONFIG = {} diff -r 488a1fa637a0 -r aa8680af29c2 kallithea/lib/celery_app.py --- a/kallithea/lib/celery_app.py Sat Nov 07 18:49:57 2020 +0100 +++ b/kallithea/lib/celery_app.py Fri Nov 06 18:57:56 2020 +0100 @@ -19,8 +19,6 @@ import celery import tg -import kallithea - class CeleryConfig(object): imports = ['kallithea.model.async_tasks'] @@ -79,6 +77,5 @@ """Create celery app from the TurboGears configuration file""" app = celery.Celery() celery_config = make_celery_config(tg.config) - kallithea.CELERY_EAGER = celery_config.task_always_eager app.config_from_object(celery_config) return app diff -r 488a1fa637a0 -r aa8680af29c2 kallithea/lib/celerylib/__init__.py --- a/kallithea/lib/celerylib/__init__.py Sat Nov 07 18:49:57 2020 +0100 +++ b/kallithea/lib/celerylib/__init__.py Fri Nov 06 18:57:56 2020 +0100 @@ -127,7 +127,7 @@ ret = func(*fargs, **fkwargs) return ret finally: - if kallithea.CELERY_APP and not kallithea.CELERY_EAGER: + if kallithea.CELERY_APP and not kallithea.CELERY_APP.conf.task_always_eager: meta.Session.remove() return decorator(__wrapper, func)