fix: 将异步写入函数改为同步,以确保文件写入的稳定性

This commit is contained in:
Wenjie Zhang 2025-10-12 02:09:33 +08:00
parent 246e133eb4
commit 54bb8e1e4f

View File

@ -285,7 +285,7 @@ class Tasker:
tasks = [task.to_dict() for task in self._tasks.values()]
payload = {"tasks": tasks, "updated_at": _utc_timestamp()}
async def _write() -> None:
def _write() -> None:
self._storage_path.parent.mkdir(parents=True, exist_ok=True)
tmp_path = self._storage_path.with_suffix(".tmp")
with open(tmp_path, "w", encoding="utf-8") as fh: