perf: keep-alive upstream sessions, TTL cache on upstream data, /stream LRU, cache hls.min.js

- shared thread-local curl_cffi sessions (no TLS handshake per call)
- in-memory TTL cache: search 5min, details/episodes/languages/
  playlist-URLs 1h; api_stream retries once with a cold cache on 502
  (recovers rotated playlist URLs)
- /stream LRU (24 entries) serves re-seeks and playlist re-fetches from memory
- hls.min.js: Cache-Control public max-age=30d (was no-store -> 500KB
  re-download per page load on mobile)

Measured (click->play chain, cold -> warm):
  search    0.45s -> 0.00s
  detail    0.46s -> 0.00s
  episodes  0.40s -> 0.00s
  stream    1.06s -> 0.00s
  m3u8 x2   0.64s -> 0.00s
  segment   0.20s -> 0.00s
This commit is contained in:
jozamudi committed 2026-08-19 17:46:17 +00:00
1 parent ca86daf9a6
commit 19e878800c
3 files changed
+84 -14

No files matched your search

+3
View File
@@ -47,6 +47,9 @@ the app or CLI are rejected immediately, even with an old cookie.
- Search with poster grid, detail view with synopsis + season tabs
- HLS playback (vendored hls.js), browser ABR across 1080/720/360p
- Dub/sub toggle
- Fast repeat navigation: upstream data is TTL-cached and HLS
playlists/segments are LRU-cached, so re-opening a show or re-seeking is
near-instant (first load still pays the upstream round-trips)
- Autoplays the first episode (or resumes the last watched one); if the
browser blocks autoplay, a "click to play" overlay appears