-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Serve thumbnails over P2P #2524
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
93bc6c3
to
8c59e77
Compare
8c59e77
to
ef870c1
Compare
let (path, home_node) = if library_id == "ephemeral" { | ||
(get_ephemeral_thumb_key(&cas_id), None) | ||
} else { | ||
let library_id = Uuid::from_str(&library_id).map_err(bad_request)?; |
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.
By running these database queries within the file serving code, this PR significantly slows the loading of all preview media so we might want to do this out of band.
loadState.thumbnail !== 'error' && | ||
itemData.hasLocalThumbnail && | ||
itemData.thumbnailKey.length > 0 | ||
loadState.thumbnail !== 'error' // && |
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.
Without this check disabled the node will just fallback to the placeholder instead of making a request over P2P to the other node for the file.
Obviously disabling it like i've done here is not a permanent solution.
if (itemData.thumbnailKey.length > 0) | ||
return platform.getThumbnailUrlByThumbKey(itemData.thumbnailKey); | ||
if (itemData.casId) | ||
return platform.getThumbnailUrlByThumbKey(library.uuid, itemData.casId); |
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.
With the current implementation this can be called as:
platform.getThumbnailUrlByThumbKey("ephemeral", itemData.casId)
platform.getThumbnailUrlByThumbKey(library.uuid, itemData.casId)
As the codebase has no calls using the "ephemeral"
variant I am certain this PR breaks thumbnails for the ephemeral explorer.
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.
As I finish at Spacedrive tomorrow i'm not going to be able to drive this PR to completion but i've solved the P2P part making it easy for someone else to pick up if they can fix the thumbnail handling parts.
lets get this picked up @ameer2468 |
This PR builds on top of #2523 to allow thumbnails to be served via P2P from the node where the file exists.
Although we will sync preview media, having the ability to serve it over P2P means we can suffice before the first sync and we can also support scenarios were only a portion of the preview media is sunk.