fix: instant video thumbnails on tab switch + throttle decodes

Backend:
- 204 response: add Cache-Control: no-store so browser never caches
  'no thumbnail yet' — next GET after PUT upload gets the WebP

Frontend:
- _videoThumbCache (Map): persists fileId → URL across re-renders,
  so switching tabs reuses cached URLs instantly (no re-decode)
- Render: videos with cached URL skip the 204/error/decode cycle
- After PUT succeeds: swap blob URL → server ?v=1 URL so blob is GC'd
- Concurrency throttle: max 3 simultaneous video decodes to avoid
  overwhelming network + CPU when gallery has many videos
- Decode queue: pending videos processed as slots free up
This commit is contained in:
Diocrafts
2026-03-07 19:06:37 +01:00
parent db93b48149
commit 2aeb97383c
2 changed files with 63 additions and 7 deletions
+6 -1
View File
@@ -349,7 +349,12 @@ impl FileHandler {
.unwrap()
.into_response();
}
return StatusCode::NO_CONTENT.into_response();
return Response::builder()
.status(StatusCode::NO_CONTENT)
.header(header::CACHE_CONTROL, "no-store")
.body(Body::empty())
.unwrap()
.into_response();
}
// Resolve the physical blob path (content-addressable storage)