increase the waiting time for celery restarts

This commit is contained in:
yangdsh 2020-01-30 15:23:45 +00:00 committed by Dana Van Aken
parent d0cf8b597d
commit ae98fdcb32
1 changed files with 4 additions and 4 deletions

View File

@ -498,7 +498,7 @@ def model_to_dict2(m, exclude=None):
def check_and_run_celery(): def check_and_run_celery():
celery_status = os.popen('python manage.py celery inspect ping').read() celery_status = os.popen('python3 manage.py celery inspect ping').read()
if 'OK' in celery_status: if 'OK' in celery_status:
return 'celery is running' return 'celery is running'
@ -507,9 +507,9 @@ def check_and_run_celery():
LOG.warning('Celery is not running.') LOG.warning('Celery is not running.')
retries += 1 retries += 1
call_command('stopcelery') call_command('stopcelery')
os.popen('python manage.py startcelery &') os.popen('python3 manage.py startcelery &')
time.sleep(5 * retries) time.sleep(30 * retries)
celery_status = os.popen('python manage.py celery inspect ping').read() celery_status = os.popen('python3 manage.py celery inspect ping').read()
if 'OK' in celery_status: if 'OK' in celery_status:
LOG.info('Successfully start celery.') LOG.info('Successfully start celery.')
return 'celery stopped but is restarted successfully' return 'celery stopped but is restarted successfully'