diff --git a/rhodecode/lib/celerylib/loader.py b/rhodecode/lib/celerylib/loader.py --- a/rhodecode/lib/celerylib/loader.py +++ b/rhodecode/lib/celerylib/loader.py @@ -32,6 +32,7 @@ inspect_getargspec() inspect_formatargspec() # python3.11 inspect patches for backward compat on `paste` code +import sys import logging import importlib @@ -160,12 +161,12 @@ def _init_celery(app_type=''): try: env = bootstrap(ini_file, options=options) except Exception: - log.exception('Failed to bootstrap RhodeCode APP') + log.exception('Failed to bootstrap RhodeCode APP. ' + 'Probably there is another error present that prevents from running pyramid app') if not env: - raise EnvironmentError( - 'Failed to load pyramid ENV. ' - 'Probably there is another error present that prevents from running pyramid app') + # we use sys.exit here since we need to signal app startup failure for docker to restart the container and re-try + sys.exit(1) log.debug('Got Pyramid ENV: %s', env)