feat(monitor): 超级编导自动追加,任务设置里按间隔补新作品
任务编辑里新增「自动从超级编导追加新作品」(抖音 + 作品模式才有): - 每 N 分钟(默认 2 小时)按**发布时间**查一次数据中心,把这段时间新发布、 还没在任务里的作品追加进去;已有的不会重复。 - start_time/end_time 实测按发布时间过滤,所以老活动里今天才发的作品也能 收到 —— 按活动创建时间筛会整批漏掉。 - 查询窗口首尾重叠 1 小时,兜住数据中心的索引延迟;失败时 last_at 不动, 恢复后这段时间的作品仍在窗口里,只把调度钟按 30 分钟退避重试。 - 同步跑在后台任务里,不阻塞采集调度。 Co-Authored-By: Claude <[email protected]>
This commit is contained in:
@@ -117,6 +117,25 @@ class MonitorTask(MonitorBase):
|
||||
notify_enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
notify_failures: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
||||
|
||||
# 超级编导自动追加:每隔 N 分钟查一次这段时间**新发布**的作品,追加到本任务。
|
||||
# 只有抖音的作品模式任务能开(目标是作品 id;博主模式的目标是主页)。
|
||||
#
|
||||
# ``next_at`` 是调度钟,成功失败都往后推(失败按较短的退避重试);
|
||||
# ``last_at`` 是**成功**的窗口起点,失败时不动 —— 这样接口挂了两个小时,恢复后
|
||||
# 那两小时的作品还在窗口里,不会悄悄漏掉。
|
||||
superdir_auto_enabled: Mapped[bool] = mapped_column(
|
||||
Boolean, nullable=False, default=False
|
||||
)
|
||||
superdir_auto_interval_minutes: Mapped[int] = mapped_column(
|
||||
Integer, nullable=False, default=120
|
||||
)
|
||||
superdir_auto_next_at: Mapped[Optional[int]] = mapped_column(BigInteger)
|
||||
superdir_auto_last_at: Mapped[Optional[int]] = mapped_column(BigInteger)
|
||||
superdir_auto_last_added: Mapped[Optional[int]] = mapped_column(Integer)
|
||||
superdir_auto_last_error: Mapped[str] = mapped_column(
|
||||
String(500), nullable=False, default=""
|
||||
)
|
||||
|
||||
# Scheduler state. Persisted so the schedule survives an API restart.
|
||||
next_run_at: Mapped[Optional[int]] = mapped_column(BigInteger, index=True)
|
||||
last_run_at: Mapped[Optional[int]] = mapped_column(BigInteger)
|
||||
|
||||
Reference in New Issue
Block a user