fix: restore ext-thumbnail disk lookup in get_cached_thumbnail
After the blob_hash dedup change, get_cached_thumbnail with
blob_hash=None (cache-first fast path) only checked moka. External
video thumbnails stored as ext-{file_id}.jpg on disk were not found
after a server restart when moka is empty.
Now checks ext-{file_id}.jpg on disk before falling through to the
blob-hash disk lookup, so video thumbnails survive restarts.
This commit is contained in:
@@ -280,7 +280,19 @@ impl ThumbnailService {
|
||||
return Some(bytes);
|
||||
}
|
||||
|
||||
// 2. Check disk (needs blob_hash to locate the shared file)
|
||||
// 2. Check disk for external (video-frame) thumbnails stored by file_id.
|
||||
// These don't require blob_hash since they use ext-{file_id}.jpg paths.
|
||||
let ext_path = self
|
||||
.thumbnails_root
|
||||
.join(size.dir_name())
|
||||
.join(format!("ext-{}.jpg", file_id));
|
||||
if let Ok(data) = fs::read(&ext_path).await {
|
||||
let bytes = Bytes::from(data);
|
||||
self.cache.insert(cache_key.clone(), bytes.clone()).await;
|
||||
return Some(bytes);
|
||||
}
|
||||
|
||||
// 3. Check disk for blob-hash thumbnails (needs blob_hash to locate)
|
||||
let hash = blob_hash?;
|
||||
let thumb_path = self.get_thumbnail_path(hash, size);
|
||||
if let Ok(data) = fs::read(&thumb_path).await {
|
||||
|
||||
Reference in New Issue
Block a user