对于健壮、持久的后台任务(超越 FastAPI 的轻量级 BackgroundTasks),您使用真正的任务队列:Celery(既定标准)或 ARQ(现代异步原生队列)。这些在单独的 worker 进程中运行繁重、可重试、计划的工作,由 Redis 等 broker 支持。
为什么不仅仅使用 BackgroundTasks?
text
BackgroundTasks runs in the web process → NO persistence (lost on crash), NO retries,
NO scheduling, and heavy work ties up the worker. Fine only for quick fire-and-forget.
For durable/critical/heavy/scheduled jobs → use a real task queue (Celery / ARQ).
