1 round trip for both uploading and determining asset duplication #8847
truongsinh
started this conversation in
General
Replies: 1 comment 4 replies
-
I like the idea. A potential problem that comes to mind is that the upload request body includes not just the asset data, but also other fields like favourite/archived flags and such. If we short-circuit because of the checksum header, there's no way to still read those but not the asset data right? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Spin of from #8825
The current design, which separates
checkBulkUpload
andupload
into two distinct operations, introduces unnecessary server roundtrips, resulting in both performance and functionality issues. A more streamlined approach would be to integrate these processes into a single endpoint. This could be efficiently managed using anx-immich-checksum
header to initially assess the asset. If the checksum identifies an asset that already exists and belongs to the same user, the server can simply return an HTTP 304 status code, indicating no change and eliminating the need for an upload. If the checksum matches an asset that exists but belongs to a different user, the server can respond with an HTTP 201, indicating that the asset is created (but through server-side copying mechanisms like hard links or --reflink=always, instead of consuming body stream). This method reduces bandwidth and storage requirements by preventing unnecessary uploads, optimizing overall system performance and resource utilization.Beta Was this translation helpful? Give feedback.
All reactions