fix(celery): signal startup failure with sys.exit to recycle celery worker on errors
This commit is contained in:
parent
f3e09a5995
commit
29de931a2e
1 changed files with 5 additions and 4 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue