Repository navigation
itemsync: Fix GUI freeze when removing all items and on startup - #3629
Conversation
Codecov Reportâ Patch coverage is
â Your patch status has failed because the patch coverage (64.40%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #3629 +/- ##
==========================================
- Coverage 74.44% 74.36% -0.09%
==========================================
Files 253 253
Lines 37916 37912 -4
Branches 5120 5114 -6
==========================================
- Hits 28228 28192 -36
- Misses 9688 9720 +32 â View full report in Codecov by Harness. ð New features to boost your workflow:
|
dc24a6c to
d378869
Compare
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent UI freezes in the ItemSync plugin by reducing expensive per-row work during item removal and by avoiding retry/sleep loops for read-only file opens (letting the file watcher handle transient failures on the next cycle).
Changes:
- Added a regression test covering reading a large (lazy-loaded) item after its backing file is deleted.
- Reworked file-operation retry handling to allow zero-retry read-only opens and improved logging for read-open failures.
- Introduced a batched API to remove files for multiple removed indexes in one call.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/itemsynctests.h | Declares a new ItemSync test slot. |
| src/tests/itemsynctests.cpp | Adds a regression test for reading a large item after its backing file is deleted. |
| plugins/itemsync/itemsync.cpp | Switches item-removal cleanup to a batched file-removal helper. |
| plugins/itemsync/filewatcher.h | Replaces single-index removal API with a multi-index variant (optional own-only filtering). |
| plugins/itemsync/filewatcher.cpp | Adjusts retry semantics for read-only operations, centralizes read-open failure logging, and batches file removal for removed indexes. |
ðĄ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Batch the duplicate-baseName check when removing items so the model is scanned once instead of once per removed row, reducing O(NÂē) to O(N+M). Skip file-open retries (with sleep) for read-only operations; transient failures are handled by the file watcher on the next cycle. This prevents accumulated sleep time from freezing the UI on startup after a crash. Log a warning when a sync file exists but cannot be opened for reading; use debug level when the file was simply deleted (normal sync operation). Assisted-by: Claude (Anthropic)
Batch the duplicate-baseName check when removing items so the model is scanned once instead of once per removed row, reducing O(NÂē) to O(N+M).
Skip file-open retries (with sleep) for read-only operations; transient failures are handled by the file watcher on the next cycle. This prevents accumulated sleep time from freezing the UI on startup after a crash.
Always log a warning when a sync file cannot be opened for reading.
Assisted-by: Claude (Anthropic)