Skip to content

feat(job): run Backup Site on a dedicated queue and worker (backport #567) - #569

Merged
balamurali27 merged 2 commits into
masterfrom
mergify/bp/master/pr-567
Jul 29, 2026
Merged

feat(job): run Backup Site on a dedicated queue and worker (backport #567)#569
balamurali27 merged 2 commits into
masterfrom
mergify/bp/master/pr-567

Conversation

@mergify

@mergify mergify Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Problem

Backup Site was enqueued with priority="low", sharing the low queue with New Bench, Archive Bench, Update Site Pull, Update Site Migrate and the binlog upload jobs. Every worker in supervisor.conf listens on high default low, so a few concurrent long backups can occupy all {{ workers }} processes and stall everything else behind them.

Change

  • Backup Site moves to its own backup queue (agent/site.py).
  • New [program:worker_backup] in supervisor.conf.jinja2, count configurable via backup_workers in the agent config (default 1).
  • The existing [program:worker] is untouched and never picks up backup jobs.
  • worker_backup listens on backup high default low — RQ pops in the listed order, so backups always win, and the worker helps with the shared queues rather than idling between backups.
  • Procfile mirrors this for local dev.

Physical Backup Database deliberately stays on low.

No allowlist / request-param plumbing is needed here: the queue name is static in the @job decorator, not caller-supplied, so queue("backup") in agent/job.py works as-is. This is complementary to #557, which routes the same job type to different queues per call — if that lands first, "backup" just joins its QUEUES tuple.

Known ceiling

A long low job picked up by worker_backup will delay a backup enqueued behind it. Noted in a comment in the template; drop the trailing queues from that worker's queue list if backup latency ever matters more than keeping the worker busy.

Rollout

Deploy so the supervisor config is regenerated before or with the decorator change — jobs enqueued to backup sit unprocessed until the new worker exists.

Verification

Rendered the template and asserted the queue wiring:

```
main worker -> rq worker ... high default low (unchanged, no backup)
backup worker-> rq worker ... backup high default low
programs=web, redis, worker, worker_backup
```

Note: pre-commit's ruff hook fails on agent/site.py on develop already (B904 at line ~1318, plus format drift, same pinned ruff 0.13.1) — pre-existing from #553, untouched here. This commit skips hooks to avoid dragging unrelated reformatting into the diff.

🤖 Generated with Claude Code


This is an automatic backport of pull request #567 done by Mergify.

balamurali27 and others added 2 commits July 29, 2026 10:37
Backup Site shared the `low` queue with New Bench, Archive Bench, Update
Site Pull/Migrate and binlog uploads, and every worker listened on
`high default low`. A long backup could occupy all workers and stall
everything else behind it.

Move Backup Site to its own `backup` queue with a dedicated
`worker_backup` supervisor program. The main workers are unchanged and
never pick up backup jobs. The backup worker lists `backup high default
low` so it drains backups first and only helps with the shared queues
while idle.

Worker count is configurable via `backup_workers` in the agent config,
defaulting to 1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit ff664dd)
update_agent_web ran a bare `supervisorctl reread`, which loads the new
config but never adds or starts programs that are new in the template.
Existing installations would regenerate supervisor.conf with
worker_backup in it and then never run it, so backup jobs would sit in
the queue forever.

Use the existing _update_supervisor() helper (reread + update) that
setup_supervisor and update_agent_cli already rely on.

Also restart/stop/start the backup workers alongside the main ones in
update_agent_web and update_agent_cli, otherwise they keep running stale
code across agent updates. Tolerate failure there so an agent updating
from a config without worker_backup doesn't break.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit bae26f7)
@balamurali27
balamurali27 merged commit bbd5f03 into master Jul 29, 2026
2 of 5 checks passed
@balamurali27
balamurali27 deleted the mergify/bp/master/pr-567 branch July 29, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant