Enable graceful shutdown of rq workers (#5214)

* Enable graceful shutdown of rq workers

* Use `exec` in the `worker` command of the entrypoint to propagate
  the `TERM` signal
* Allow rq processes managed by supervisor to exit without restart on
  expected status codes
* Allow supervisorctl to contact the running supervisor
* Add a `shutdown_worker` command that will send `TERM` to all running
  worker processes and then sleep. This allows orchestration systems
  to initiate a graceful shutdown before sending `SIGTERM` to
  supervisord

* Use Heroku worker as the BaseWorker

This implements a graceful shutdown on SIGTERM, which simplifies
external shutdown procedures.

* Fix imports based upon review

* Remove supervisorctl config
This commit is contained in:
Josh Bohde
2020-11-05 03:49:45 -06:00
committed by GitHub
parent c6bf8a1c55
commit e2e8714155
2 changed files with 6 additions and 5 deletions

View File

@@ -18,8 +18,8 @@ worker() {
export WORKERS_COUNT=${WORKERS_COUNT:-2}
export QUEUES=${QUEUES:-}
supervisord -c worker.conf
exec supervisord -c worker.conf
}
dev_worker() {