Skip to content
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

feat: Split upload queue in two behind a new service #1470

Draft
wants to merge 49 commits into
base: master
Choose a base branch
from

Conversation

adrien-coye
Copy link
Contributor

@adrien-coye adrien-coye commented Mar 10, 2025

Abstract

Strictly compatible refactor aiming at splitting the upload queues between photoSync and all other uploads.
This PR is only the creation on an UploadService and the creation of two dedicated queues.

Here, all uploads are still performed in the same queue.
This PR Draft enables the photo sync on a separate queue

Service:
  • New UploadService to centralise upload management
    • UploadService encapsulate two uploadQueue, one for photo sync and one global
  • Refactored database access, now made in the UploadService exclusively, not in the queue
  • Pure Protocol based, easier to test and no longer working with concrete types
Queues:
  • UploadQueue is focussed on queue related work, removed DB code.
  • New PhotoSyncUploadQueue, subclassing UploadQueue will be dedicated to photo upload is a sub PR.
Dependencies

Depends on #1471

@adrien-coye adrien-coye force-pushed the feat/split-upload-queue branch from 3dcb3bf to c66db3b Compare March 10, 2025 13:16
@adrien-coye adrien-coye force-pushed the feat/split-upload-queue branch from c66db3b to 955ad0e Compare March 10, 2025 13:26
@adrien-coye adrien-coye force-pushed the feat/split-upload-queue branch from 05bd211 to 580f3ce Compare March 11, 2025 15:57
@adrien-coye adrien-coye changed the title feat: Split photoSync upload queue from the common queue feat: Split upload queue in two behind a new service object Mar 12, 2025
Copy link
Contributor Author

@adrien-coye adrien-coye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a self assessment, marked all new To-dos that will be done in a sub PR


// TODO: Add to the correct queue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

lazyCollection.filter("id IN %@", batchArray).freezeIfNeeded()
}
for file in matchedFrozenFiles {
// TODO: Do it in this object and forward objects to specific queues
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

}

// Remove operation from tracking
// TODO: Split two specific queues
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

return
}

// TODO: Split two specific queues
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO


try? uploadsDatabase.writeTransaction { writableRealm in
for uploadFileId in batch {
// TODO: Split two specific queues
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

continue
}

// TODO: Split two specific queues
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

Log.uploadQueue("Done deleting all matching files for parentId:\(parentId)")
}

// TODO: Split between queues in sub PR
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

let frozenFileToDelete = toDeleteLive.freeze()
frozenFileToDelete.cleanSourceFileIfNeeded()

// TODO: Select correct upload queue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

Copy link

This PR/issue depends on:

@adrien-coye adrien-coye changed the title feat: Split upload queue in two behind a new service object feat: Split upload queue in two behind a new service Mar 12, 2025
@adrien-coye adrien-coye changed the base branch from photoSyncUploadQueue to master March 12, 2025 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant