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(Mobile): Use client side hash to check if asset exists in remote before backup #9306

Closed
wants to merge 3 commits into from

Conversation

dramikei
Copy link

@dramikei dramikei commented May 7, 2024

Allows Client to check for asset existence in remote server by making use of asset SHA-1 checksum along with API implemented in #2072

Fixes #1553

Problem statement:

When reinstalling immich app, or when asset backup already exists on immich server (through icloudpd and immich-cli for example) the client app uploads all the assets from the device which then get deduplicated from the server-side. Resulting in unnecessary upload of 20k+ assets, wasted bandwidth and time.

Change:

Assets that are already on the server are ignored and not uploaded to the server

Tests:

  • Tested on Android (emulator)
  • Tested on iOS (physical device)

@dramikei
Copy link
Author

dramikei commented May 7, 2024

Found some issues while testing on iOS:

  1. Hashing a large amount of files takes quite some time, so its better to convert hashing before backup into a cancellable "job" of its own with persistence in case app gets killed
  2. If we have assets uploaded to icloud with Optimize storage turned on, the hashing function sometimes fails to fetch the original file because of final file = await assetEntities[i].originFile; in hash service. converting this to final file = await assetEntities[i].loadFile(withSubtype: Platform.isIOS); seems to fix the issue, but raises another concern (see point 3)
  3. when using loadFile PhotoManagerPlugin downloads each asset to hash, which slows down the entire backup preparation.

@alextran1502
Copy link
Contributor

Closing as this PR is now stale

@MrModest
Copy link

@alextran1502 does anyone else working on improving this other way? 🤔

@alextran1502
Copy link
Contributor

@MrModest yes, me. There is a WIP branch

@MrModest
Copy link

MrModest commented Sep 12, 2024

Thank you! ❤️ Can you please drop a link, so we can subscribe to it to follow updates? :)

@alextran1502
Copy link
Contributor

@MrModest You can find the branch here https://github.com/immich-app/immich/tree/hash-on-upload

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.

Move to client side hashing
4 participants