feat(monitor): 超级编导自动追加,任务设置里按间隔补新作品
Deploy VitePress site to Pages / build (push) Canceled after 0s
Deploy VitePress site to Pages / Deploy (push) Canceled after 0s

任务编辑里新增「自动从超级编导追加新作品」(抖音 + 作品模式才有):

- 每 N 分钟(默认 2 小时)按**发布时间**查一次数据中心,把这段时间新发布、
  还没在任务里的作品追加进去;已有的不会重复。
- start_time/end_time 实测按发布时间过滤,所以老活动里今天才发的作品也能
  收到 —— 按活动创建时间筛会整批漏掉。
- 查询窗口首尾重叠 1 小时,兜住数据中心的索引延迟;失败时 last_at 不动,
  恢复后这段时间的作品仍在窗口里,只把调度钟按 30 分钟退避重试。
- 同步跑在后台任务里,不阻塞采集调度。

Co-Authored-By: Claude <[email protected]>
This commit is contained in:
2026-10-25 07:58:05 +08:00
co-authored by Claude
parent 809692a957
commit be22b30a83
8 changed files with 470 additions and 4 deletions
+7
View File
@@ -64,6 +64,9 @@ class MonitorTaskCreate(BaseModel):
# 异常频率低且意味着任务已经停止工作(默认开,否则你会一直不知道)。
notify_enabled: bool = False
notify_failures: bool = True
# 超级编导自动追加(只有抖音的作品模式任务能用,服务层会校验)。
superdir_auto_enabled: bool = False
superdir_auto_interval_minutes: int = Field(default=120, ge=30, le=1440)
# Raw pasted values: full URLs or bare ids, in either form.
targets: List[str] = Field(min_length=1)
@@ -100,6 +103,10 @@ class MonitorTaskUpdate(BaseModel):
run_timeout_seconds: Optional[int] = Field(default=None, ge=60, le=86400)
notify_enabled: Optional[bool] = None
notify_failures: Optional[bool] = None
superdir_auto_enabled: Optional[bool] = None
superdir_auto_interval_minutes: Optional[int] = Field(
default=None, ge=30, le=1440
)
# When present, replaces the whole target list.
targets: Optional[List[str]] = None