Files
Auto_Bangumi/docs/en/dev/plugins/points/scheduled-task.md
Estrella Pan 3258fcca4b docs(4.0-P7): 插件开发文档拆分为总览加每个扩展点一页,补齐中英日三语
- docs/dev/plugins.md 改为总览与导航,旧内容拆入 docs/dev/plugins/
- 新增核心概念、配置表单、事件、前端挂载点、命令行、签名与分发、内置插件、示例页
- 每个扩展点一页,侧边栏由页面表生成
- 改正旧文档中下载器配置、hardlink path_map 与补链按钮的过时描述
2026-10-08 14:51:00 +02:00

1023 B

Scheduled Task (scheduled_task)

Adds a periodic background task. @provider(points.SCHEDULED_TASK, id=...) returns a ScheduledTask.

from ab_sdk.tasks import ScheduledTask

@provider(points.SCHEDULED_TASK, id="sync")
def sync(self):
    async def run() -> None:
        ...

    return ScheduledTask(run, interval=lambda: self.config.interval, initial_delay=60)
Field Description
run An async function with no parameters
interval The wait between two runs, in seconds. It can be a function. AB reads it again each round, so it follows configuration changes
initial_delay The seconds to wait before the first run. Default 0
enabled An optional function. If it returns False, AB skips that round
  • The task runs only while the program runs. It starts and stops together with built-in tasks such as the RSS refresh.
  • An exception from run counts toward the plugin breaker.
  • The interval starts when the previous run ends. It is not a fixed beat.