diff --git a/fns_cli/file_sync.py b/fns_cli/file_sync.py index a7cee47..93e5500 100644 --- a/fns_cli/file_sync.py +++ b/fns_cli/file_sync.py @@ -2,6 +2,7 @@ from __future__ import annotations +import asyncio import logging import os import uuid @@ -203,6 +204,7 @@ async def _on_sync_update(self, msg: WSMessage) -> None: except Exception: log.exception("Failed to write file %s", rel_path) finally: + await asyncio.sleep(0.6) self.engine.unignore_file(rel_path) self._received_modify += 1 @@ -232,6 +234,7 @@ async def _on_sync_delete(self, msg: WSMessage) -> None: except Exception: log.exception("Failed to delete file %s", rel_path) finally: + await asyncio.sleep(0.6) self.engine.unignore_file(rel_path) self._received_delete += 1 @@ -256,6 +259,7 @@ async def _on_sync_rename(self, msg: WSMessage) -> None: except Exception: log.exception("Failed to rename file %s → %s", old_path, new_path) finally: + await asyncio.sleep(0.6) self.engine.unignore_file(old_path) self.engine.unignore_file(new_path) @@ -315,8 +319,9 @@ async def _finalize_download(self, session_id: str, session: _DownloadSession) - except Exception: log.exception("Failed to write downloaded file %s", rel_path) finally: - self.engine.unignore_file(rel_path) self._download_sessions.pop(session_id, None) + await asyncio.sleep(0.6) + self.engine.unignore_file(rel_path) async def _on_sync_end(self, msg: WSMessage) -> None: data = _extract_inner(msg.data) diff --git a/fns_cli/note_sync.py b/fns_cli/note_sync.py index 6a63f8a..83cc2d5 100644 --- a/fns_cli/note_sync.py +++ b/fns_cli/note_sync.py @@ -2,6 +2,7 @@ from __future__ import annotations +import asyncio import logging import os import uuid @@ -147,6 +148,7 @@ async def _on_sync_modify(self, msg: WSMessage) -> None: except Exception: log.exception("Failed to write %s", rel_path) finally: + await asyncio.sleep(0.6) self.engine.unignore_file(rel_path) self._received_modify += 1 @@ -167,6 +169,7 @@ async def _on_sync_delete(self, msg: WSMessage) -> None: except Exception: log.exception("Failed to delete %s", rel_path) finally: + await asyncio.sleep(0.6) self.engine.unignore_file(rel_path) self._received_delete += 1