From b16eca0be2179a49e45510ddde48698d7aa181bb 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 e960373..1720297 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 77882f0..7dc002c 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 3b2cec0..a8e3c09 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 494b372..3bb4ffa 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 -- 2.5.0