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:
parent
e16310062b
commit
7554b0c105
4 changed files with 4 additions and 2 deletions
|
@ -7,6 +7,7 @@ start on runlevel [2345]
|
||||||
stop on runlevel [!2345]
|
stop on runlevel [!2345]
|
||||||
|
|
||||||
respawn
|
respawn
|
||||||
|
reload signal TERM
|
||||||
|
|
||||||
env VENV=/srv/pandora
|
env VENV=/srv/pandora
|
||||||
env USER=pandora
|
env USER=pandora
|
||||||
|
|
|
@ -7,6 +7,7 @@ start on runlevel [2345]
|
||||||
stop on runlevel [!2345]
|
stop on runlevel [!2345]
|
||||||
|
|
||||||
respawn
|
respawn
|
||||||
|
reload signal TERM
|
||||||
|
|
||||||
env VENV=/srv/pandora
|
env VENV=/srv/pandora
|
||||||
env USER=pandora
|
env USER=pandora
|
||||||
|
|
|
@ -15,7 +15,7 @@ ExecStart=/srv/pandora/bin/python /srv/pandora/pandora/manage.py \
|
||||||
-Q encoding -n pandora-encoding \
|
-Q encoding -n pandora-encoding \
|
||||||
--pidfile /run/pandora/encoding.pid \
|
--pidfile /run/pandora/encoding.pid \
|
||||||
-l INFO
|
-l INFO
|
||||||
ExecReload=/bin/kill -HUP $MAINPID
|
ExecReload=/bin/kill -TERM $MAINPID
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -15,7 +15,7 @@ ExecStart=/srv/pandora/bin/python /srv/pandora/pandora/manage.py \
|
||||||
-Q default,celery -n pandora-default \
|
-Q default,celery -n pandora-default \
|
||||||
--pidfile /run/pandora/tasks.pid \
|
--pidfile /run/pandora/tasks.pid \
|
||||||
-l INFO
|
-l INFO
|
||||||
ExecReload=/bin/kill -HUP $MAINPID
|
ExecReload=/bin/kill -TERM $MAINPID
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
Loading…
Reference in a new issue