禁止API直接调用Worker任务函数,必须走Celery队列 #775

Closed
opened 2026-07-23 20:41:55 +08:00 by xiaoxia · 0 comments
Owner

问题描述

API层直接import并调用Worker的任务函数,绕过Celery队列,同步执行,破坏了异步任务的设计初衷,可能导致API响应超时和资源竞争问题。

目标

所有异步任务必须走Celery,API只发任务不直接执行,确保架构分层清晰。

验收标准

  • API代码中无 from apps.worker import 任务函数 的模式
  • 所有异步调用通过 Celery delay/apply_async 方式发起
  • 相关单元测试覆盖异步任务调用链路
## 问题描述 API层直接import并调用Worker的任务函数,绕过Celery队列,同步执行,破坏了异步任务的设计初衷,可能导致API响应超时和资源竞争问题。 ## 目标 所有异步任务必须走Celery,API只发任务不直接执行,确保架构分层清晰。 ## 验收标准 - [ ] API代码中无 `from apps.worker import 任务函数` 的模式 - [ ] 所有异步调用通过 Celery delay/apply_async 方式发起 - [ ] 相关单元测试覆盖异步任务调用链路
xiaoxia added this to the 代码质量清理专项 milestone 2026-07-23 20:41:55 +08:00
xiaoxia added the backendP0refactorarchitecture labels 2026-07-23 20:41:55 +08:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: xiaoxia/xiaoxia-saas#775