Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -47,5 +47,24 @@ uv run python manage.py migrate --noinput
|
||||
# worker must too or hashed lookups raise ValueError.
|
||||
uv run python manage.py collectstatic --noinput
|
||||
|
||||
interval="${DISPATCH_DUE_INTERVAL_SECONDS:-15}"
|
||||
echo "Starting dispatch_due poller (every ${interval}s)."
|
||||
uv run python manage.py dispatch_due --loop --interval "${interval}" &
|
||||
dispatch_pid=$!
|
||||
|
||||
cleanup() {
|
||||
echo "Stopping dispatch_due poller..."
|
||||
kill "${dispatch_pid}" 2>/dev/null || true
|
||||
wait "${dispatch_pid}" 2>/dev/null || true
|
||||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
# Dev uses ImmediateBackend: enqueue runs inline in dispatch_due. No dj-queue.
|
||||
if [[ "${DJANGO_ENV:-}" == "dev" ]]; then
|
||||
echo "Dev worker: dispatch_due loop publishes scheduled work."
|
||||
wait "${dispatch_pid}"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# dj-queue supervisor (workers + dispatcher + scheduler). Run on ONE host only.
|
||||
exec uv run python manage.py dj_queue
|
||||
uv run python manage.py dj_queue
|
||||
|
||||
Reference in New Issue
Block a user