mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-10-30 04:06:04 +08:00
- docs/dev/plugins.md 改为总览与导航,旧内容拆入 docs/dev/plugins/ - 新增核心概念、配置表单、事件、前端挂载点、命令行、签名与分发、内置插件、示例页 - 每个扩展点一页,侧边栏由页面表生成 - 改正旧文档中下载器配置、hardlink path_map 与补链按钮的过时描述
1023 B
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
runcounts toward the plugin breaker. - The interval starts when the previous run ends. It is not a fixed beat.