run-dev: Run process_queue with DJANGO_AUTORELOAD_ENV.

In Django 2.2 the autoreload system has changed.
DJANGO_AUTORELOAD_ENV env variable should be set when calling code
that'll use the autoreloader. Otherwise there's some kind of race
condition in the autoreload code when SIGINT is sent, where
restart_with_reloader() (called only if the env variable isn't set)
has the subprocess module calling p.kill() on a process that's already
exited, raising ProcessLookupError and printing an ugly traceback. This
causes non-deterministic test-run-dev failures.
This commit is contained in:
Mateusz Mandera
2020-02-17 18:37:00 +01:00
committed by showell
parent 6a36edef9e
commit 36a8e61e67

View File

@@ -10,6 +10,7 @@ import traceback
from urllib.parse import urlunparse from urllib.parse import urlunparse
from django.utils.autoreload import DJANGO_AUTORELOAD_ENV
# check for the venv # check for the venv
from lib import sanity_check from lib import sanity_check
sanity_check.check_venv(__file__) sanity_check.check_venv(__file__)
@@ -141,7 +142,8 @@ cmds = [['./manage.py', 'runserver'] +
manage_args + runserver_args + ['127.0.0.1:%d' % (django_port,)], manage_args + runserver_args + ['127.0.0.1:%d' % (django_port,)],
['env', 'PYTHONUNBUFFERED=1', './manage.py', 'runtornado'] + ['env', 'PYTHONUNBUFFERED=1', './manage.py', 'runtornado'] +
manage_args + ['127.0.0.1:%d' % (tornado_port,)], manage_args + ['127.0.0.1:%d' % (tornado_port,)],
['./manage.py', 'process_queue', '--all'] + manage_args, ['env', '{}=true'.format(DJANGO_AUTORELOAD_ENV),
'./manage.py', 'process_queue', '--all'] + manage_args,
['env', 'PGHOST=127.0.0.1', # Force password authentication using .pgpass ['env', 'PGHOST=127.0.0.1', # Force password authentication using .pgpass
'./puppet/zulip/files/postgresql/process_fts_updates'], './puppet/zulip/files/postgresql/process_fts_updates'],
['./manage.py', 'deliver_scheduled_messages'], ['./manage.py', 'deliver_scheduled_messages'],