From 7554b0c1058da6236386ff0809818dea3326e3fd Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 16 Mar 2016 15:55:05 +0000 Subject: [PATCH] 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. --- etc/init/pandora-encoding.conf | 1 + etc/init/pandora-tasks.conf | 1 + etc/systemd/pandora-encoding.service | 2 +- etc/systemd/pandora-tasks.service | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/etc/init/pandora-encoding.conf b/etc/init/pandora-encoding.conf index e960373e5..1720297ec 100644 --- a/etc/init/pandora-encoding.conf +++ b/etc/init/pandora-encoding.conf @@ -7,6 +7,7 @@ start on runlevel [2345] stop on runlevel [!2345] respawn +reload signal TERM env VENV=/srv/pandora env USER=pandora diff --git a/etc/init/pandora-tasks.conf b/etc/init/pandora-tasks.conf index 77882f0b8..7dc002cd4 100644 --- a/etc/init/pandora-tasks.conf +++ b/etc/init/pandora-tasks.conf @@ -7,6 +7,7 @@ start on runlevel [2345] stop on runlevel [!2345] respawn +reload signal TERM env VENV=/srv/pandora env USER=pandora diff --git a/etc/systemd/pandora-encoding.service b/etc/systemd/pandora-encoding.service index 3b2cec07c..a8e3c094a 100644 --- a/etc/systemd/pandora-encoding.service +++ b/etc/systemd/pandora-encoding.service @@ -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 diff --git a/etc/systemd/pandora-tasks.service b/etc/systemd/pandora-tasks.service index 494b37285..3bb4ffa4b 100644 --- a/etc/systemd/pandora-tasks.service +++ b/etc/systemd/pandora-tasks.service @@ -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