From 0b31edc6dafd448bdab1a8aa815c0112e95ef4c4 Mon Sep 17 00:00:00 2001 From: Jack Kinsella Date: Wed, 1 May 2024 09:18:02 +0200 Subject: [PATCH] Document suspend and resume commands (#2068) * Document suspend and resume commands * Title case title * Modify docs --- docs/docs/index.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/docs/index.md b/docs/docs/index.md index 7413d000..ab717c52 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -471,6 +471,31 @@ To learn about workers, see the [workers][w] documentation. [w]: {{site.baseurl}}workers/ +## Suspending and Resuming + +Sometimes you may want to suspend RQ to prevent it from processing new jobs. +A classic example is during the initial phase of a deployment script or in advance +of putting your site into maintenance mode. This is particularly helpful when +you have jobs that are relatively long-running and might otherwise be forcibly +killed during the deploy. + +The `suspend` command stops workers on _all_ queues (in a single Redis database) +from picking up new jobs. However currently running jobs will continue until +completion. + +```bash +# Suspend indefinitely +rq suspend + +# Suspend for a specific duration (in seconds) then automatically +# resume work again. +rq suspend --duration 300 + +# Resume work again. +rq resume +``` + + ## Considerations for jobs Technically, you can put any Python function call on a queue, but that does not