Changeset - aa8680af29c2
[Not reviewed]
default
0 3 0
Mads Kiilerich (mads) - 5 years ago 2020-11-06 18:57:56
mads@kiilerich.com
Grafted from: 3c2910a2aead
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.
3 files changed with 1 insertions and 5 deletions:
0 comments (0 inline, 0 general)
kallithea/__init__.py
Show inline comments
 
@@ -41,7 +41,6 @@ BACKENDS = {
 
}
 

	
 
CELERY_APP = None  # set to Celery app instance if using Celery
 
CELERY_EAGER = False
 

	
 
CONFIG = {}
 

	
kallithea/lib/celery_app.py
Show inline comments
 
@@ -19,8 +19,6 @@ import logging
 
import celery
 
import tg
 

	
 
import kallithea
 

	
 

	
 
class CeleryConfig(object):
 
    imports = ['kallithea.model.async_tasks']
 
@@ -79,6 +77,5 @@ def make_app():
 
    """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
kallithea/lib/celerylib/__init__.py
Show inline comments
 
@@ -127,7 +127,7 @@ def dbsession(func):
 
            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)
0 comments (0 inline, 0 general)