init: restart celery workers on 'reload' (fixes #2904)

Sending HUP to the parent of a family of celery workers causes the
parent to re-exec itself, spawning a new set of child workers without
terminating the old ones.

So instead we send TERM to the parent on 'reload', which cleans up the
children, and rely on systemd/upstart to respawn the whole family.
This commit is contained in:
Will Thompson 2016-03-16 15:55:05 +00:00 committed by j
parent e16310062b
commit 7554b0c105
4 changed files with 4 additions and 2 deletions

View File

@ -7,6 +7,7 @@ start on runlevel [2345]
stop on runlevel [!2345]
respawn
reload signal TERM
env VENV=/srv/pandora
env USER=pandora

View File

@ -7,6 +7,7 @@ start on runlevel [2345]
stop on runlevel [!2345]
respawn
reload signal TERM
env VENV=/srv/pandora
env USER=pandora

View File

@ -15,7 +15,7 @@ ExecStart=/srv/pandora/bin/python /srv/pandora/pandora/manage.py \
-Q encoding -n pandora-encoding \
--pidfile /run/pandora/encoding.pid \
-l INFO
ExecReload=/bin/kill -HUP $MAINPID
ExecReload=/bin/kill -TERM $MAINPID
[Install]
WantedBy=multi-user.target

View File

@ -15,7 +15,7 @@ ExecStart=/srv/pandora/bin/python /srv/pandora/pandora/manage.py \
-Q default,celery -n pandora-default \
--pidfile /run/pandora/tasks.pid \
-l INFO
ExecReload=/bin/kill -HUP $MAINPID
ExecReload=/bin/kill -TERM $MAINPID
[Install]
WantedBy=multi-user.target