Skip to content

Commit 54bb8e1

Browse files
committed
fix: 将异步写入函数改为同步,以确保文件写入的稳定性
1 parent 246e133 commit 54bb8e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/services/tasker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ async def _persist_state(self) -> None:
285285
tasks = [task.to_dict() for task in self._tasks.values()]
286286
payload = {"tasks": tasks, "updated_at": _utc_timestamp()}
287287

288-
async def _write() -> None:
288+
def _write() -> None:
289289
self._storage_path.parent.mkdir(parents=True, exist_ok=True)
290290
tmp_path = self._storage_path.with_suffix(".tmp")
291291
with open(tmp_path, "w", encoding="utf-8") as fh:

0 commit comments

Comments
 (0)