Poll dispatch_due in the worker so scheduled posts fire.
CI / test (pull_request) Successful in 16s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-24 10:04:24 -05:00
co-authored by Cursor
parent 96741bc0c8
commit e79577811e
7 changed files with 113 additions and 8 deletions
+20 -1
View File
@@ -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