Repository navigation
Prevent All-history photo sync from freezing the map - #74
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1171f06b92
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if index.isMultiple(of: 100) { | ||
| // Give the main run loop time for input and lifecycle events; | ||
| // SwiftData models remain confined to the main actor. | ||
| try await Task.sleep(for: .milliseconds(1)) |
There was a problem hiding this comment.
Invalidate an in-flight photo sync when clearing data
If the user confirms Clear All Data while a large photo sync is yielding between batches, clearAllData() can now delete and save the photo records before this loop resumes. The sync then continues inserting the remaining metadata and saves it in performPhotoMomentSync, repopulating the store after the clear—including coordinates inferred from location history that was just deleted. Previously the synchronous upsert could not interleave with the clear action. Invalidate active and pending syncs when clearing data, and check that invalidation after each suspension before applying further mutations.
Useful? React with 👍 / 👎.
Summary
Selecting All on a large photo library blocks the main thread in per-asset SwiftData fetches and can trigger a watchdog termination.
Evidence
fetchPhotoMomentduring photo sync. The 2,000-photo input-responsiveness regression failed (1.98 seconds).After: The regression passes (0.16 seconds). All 301 XCTest cases pass. The attached iPhone loads 11,354 matched photos and switches All → Today; the recorded device replay passes and no new crash reports appeared.
Merge Danger
Door: two-way
Revert the commit to restore previous behavior.
Blast Radius: Photos
Changes photo metadata sync scheduling and lookup behavior; photo files remain in Photos.