feat: 添加 _ready_event 以确保文件监视器在启动时准备就绪,优化监控逻辑

This commit is contained in:
DrSmoothl
2026-03-09 15:04:58 +08:00
parent 7e2ab0d71d
commit dfa944b368
2 changed files with 12 additions and 2 deletions

View File

@@ -135,7 +135,6 @@ async def test_add_callback_while_watcher_running(tmp_path: Path):
uuid = watcher.subscribe(callback, paths=[file])
await watcher.start()
try:
await asyncio.sleep(0.5) # 等待 watcher 建立 baseline
with file.open("w") as f:
f.write("change")
await _wait_for(lambda: calls >= 1)