# HG changeset patch # User Mads Kiilerich # Date 1609529913 -3600 # Node ID 7a73baa4c66cf00ee12c717923ea264fdebdf1ac # Parent e9521559d013b7e4a97aa86643997427839a39d0 celery: don't rely on CELERY_APP only being set (from app_cfg) when use_celery We would rather always have CELERY_APP set. Kind of backing out 894a662b12b3. diff -r e9521559d013 -r 7a73baa4c66c kallithea/bin/kallithea_cli_celery.py --- a/kallithea/bin/kallithea_cli_celery.py Sat Dec 26 18:23:43 2020 +0100 +++ b/kallithea/bin/kallithea_cli_celery.py Fri Jan 01 20:38:33 2021 +0100 @@ -17,6 +17,7 @@ import kallithea import kallithea.bin.kallithea_cli_base as cli_base +from kallithea.lib.utils2 import asbool @cli_base.register_command(config_file_initialize_app=True) @@ -32,7 +33,7 @@ by this CLI command. """ - if not kallithea.CELERY_APP: + if not asbool(kallithea.CONFIG.get('use_celery')): raise Exception('Please set use_celery = true in .ini config ' 'file before running this command') diff -r e9521559d013 -r 7a73baa4c66c kallithea/lib/celerylib/__init__.py --- a/kallithea/lib/celerylib/__init__.py Sat Dec 26 18:23:43 2020 +0100 +++ b/kallithea/lib/celerylib/__init__.py Fri Jan 01 20:38:33 2021 +0100 @@ -35,7 +35,7 @@ import kallithea from kallithea.lib.pidlock import DaemonLock, LockHeld -from kallithea.lib.utils2 import safe_bytes +from kallithea.lib.utils2 import asbool, safe_bytes from kallithea.model import meta @@ -46,7 +46,7 @@ """Wrapper of celery.task.task, running async if CELERY_APP """ - if kallithea.CELERY_APP: + if asbool(kallithea.CONFIG.get('use_celery')): def f_async(*args, **kwargs): log.info('executing %s task', f_org.__name__) try: diff -r e9521559d013 -r 7a73baa4c66c kallithea/model/async_tasks.py --- a/kallithea/model/async_tasks.py Sat Dec 26 18:23:43 2020 +0100 +++ b/kallithea/model/async_tasks.py Fri Jan 01 20:38:33 2021 +0100 @@ -219,7 +219,7 @@ lock.release() # execute another task if celery is enabled - if len(scm_repo.revisions) > 1 and kallithea.CELERY_APP and recurse_limit > 0: + if len(scm_repo.revisions) > 1 and asbool(kallithea.CONFIG.get('use_celery')) and recurse_limit > 0: get_commits_stats(repo_name, ts_min_y, ts_max_y, recurse_limit - 1) elif recurse_limit <= 0: log.debug('Not recursing - limit has been reached')