-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[mob][photos] Fix backups out of sync #8257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add DeviceFolderSelectionCache to track selected backup folders and properly handle the case when a folder is deselected while uploads are in progress. This prevents files from getting stuck in an inconsistent state by cleaning up pending uploads and database entries when their source folder is no longer selected for backup.
- Add isAutoSync flag to FileUploadItem to distinguish auto-sync from manual uploads - Only apply only-new filter and folder deselection checks to auto-sync uploads - Manual uploads (retries, explicit adds) now bypass these filters - Remove dependency on enableBackupFolderSync for only-new filter - Move threshold cleanup off UI critical path with fire-and-forget pattern - Extract _cleanupPendingUpload helper to reduce duplication - Fix race condition in _pollQueue by marking entries in-progress before await Co-authored-by: Claude <[email protected]>
…nt patterns - Remove duplicate folder deselection and only-new checks from _encryptAndUploadFileToCollection (already handled in _pollQueue before calling) - Simplify removeFromQueueWhere to use _removeAndSkip for all cases - Use consistent unawaited(_pollQueue()) pattern everywhere Co-authored-by: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
Co-authored-by: Claude <[email protected]>
Co-authored-by: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
|
@ua741 can you review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
| for (EnteFile pendingUpload in pendingUploads) { | ||
| if (localIDsInOtherFileEntries.contains(pendingUpload.localID)) { | ||
| entriesToDelete.add(pendingUpload.generatedID!); | ||
| } else { | ||
| pendingUpload.collectionID = null; | ||
| entriesToUpdate.add(pendingUpload); | ||
| if (pendingUpload.queueSource == null || | ||
| pendingUpload.queueSource == manualQueueSource) { | ||
| continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cancel deselected backups even when queueSource is null
When a user deselects a device folder, removeFilesQueuedForUpload now skips any pending upload whose queueSource is null or manual. The new queue_source column is added in this commit but never backfilled, so all already-queued auto-backup entries have queueSource == null. As a result, turning off a folder no longer removes those queued uploads—they remain in the DB/queue and continue uploading despite the folder being deselected. The cleanup path should handle preexisting rows without a queueSource (or backfill them) so deselection reliably cancels pending uploads.
Useful? React with 👍 / 👎.
Description
Tests