Mercurial > kallithea
changeset 8798:aa8680af29c2
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.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 06 Nov 2020 18:57:56 +0100 |
parents | 488a1fa637a0 |
children | d2d787d881db |
files | kallithea/__init__.py kallithea/lib/celery_app.py kallithea/lib/celerylib/__init__.py |
diffstat | 3 files changed, 1 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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 = {}
--- 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
--- 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)