From f13cc03d24e59e56647dd0b38379628e13b7bfdb Mon Sep 17 00:00:00 2001 From: dandds Date: Tue, 16 Oct 2018 09:54:49 -0400 Subject: [PATCH] allow queue worker process to hot reload if entr is available --- Procfile | 2 +- README.md | 4 ++++ script/dev_queue | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 script/dev_queue diff --git a/Procfile b/Procfile index 0101271f..ba8ec7cf 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,3 @@ assets: yarn watch web: PORT=8000 python app.py -queue: flask rq worker +queue: ./script/dev_queue diff --git a/README.md b/README.md index f9cf66fd..e5adfcfc 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,10 @@ locally: running on the default port of 6379. You can ensure that Redis is running by executing `redis-cli` with no options and ensuring a connection is succesfully made. +* [`entr`](http://www.entrproject.org/) + This dependency is optional. If present, the queue worker process will hot + reload in development. + ### Cloning This project contains git submodules. Here is an example clone command that will automatically initialize and update those modules: diff --git a/script/dev_queue b/script/dev_queue new file mode 100755 index 00000000..db171e3e --- /dev/null +++ b/script/dev_queue @@ -0,0 +1,11 @@ +#!/bin/bash + +# script/dev_queue: Run the queue with entr if available + +set -e + +if [[ `command -v entr` ]]; then + find atst | entr -r flask rq worker +else + flask rq worker +fi