Repository navigation
Description
What happened?
Videos in a playlist show stale or missing metadata: the view counts never update, and the thumbnails often don't load at all (empty/grey tile). Playlist rows are a stored snapshot from the moment the video was added, and nothing keeps them current afterwards.
Expected: view counts follow the video, and a thumbnail that is missing or broken is repaired or replaced by a fallback instead of staying empty.
Steps to reproduce
- Add several videos to a playlist (or import one), some of them a while ago.
- Open the playlist (
/playlists/{id}) after days or weeks. - Compare view counts with the video pages: the playlist keeps the numbers from the time of adding.
- Look at the thumbnails: a share of the tiles stays empty and does not recover on reload.
Area
Backend (API / extraction) + Frontend (web app). Which client the reporter used when it was seen is not recorded here; the cause below is in the server, so it affects every client that reads /playlists/{id}.
Anything else?
Static code reading (server main @ 8868a7d, frontend main @ f624a39); not reproduced against a running instance.
Views never refresh (server)
PlaylistVideosTablestoresthumbnail,viewCount,publishedAtetc. per row, written once inPlaylistService.addVideo(server-services/.../PlaylistService.kt:89-110).- The only refresh path is
UserVideoMetadataRepairService, scheduled fromGET /playlists/{id}(server-http/.../PlaylistRoutes.kt:38). Its candidate query,playlistNeedsRepair(), selects only rows with a fallback title (YouTube video %), empty thumbnail,duration <= 0, empty channel name or channel URL.viewCountis not part of it, so a row that has a title, thumbnail and duration is never refreshed again — its view count stays frozen forever. (VideoMetadataResolver.shouldEnrichhas the same five conditions.)
Thumbnails often missing
- Repair is throttled hard: at most 8 videos per batch × 3 batches per run (
MAX_REPAIR_PER_REQUEST = 8,MAX_BATCHES_PER_RUN = 3), then a 5-minute per-user cooldown (REPAIR_COOLDOWN_MS,schedule()), shared across all playlists, watch later and favourites of that user. A playlist with more than ~24 incomplete rows needs several visits spaced by five minutes. The run is also in the background, so the response that triggers it already carries the old data. - The web client stops waiting too early:
usePlaylistpolls every 4 s but only up to 12 updates (hooks/use-playlist.ts:23), i.e. ~48 s. A repair that starts after the cooldown, or batch two/three of a long list, finishes after the client has stopped polling; the next time the user sees fresh data is the next manual reload. - The poll condition does not match the server:
needsMetadataalso checkschannelAvatar === "", which the server never repairs (playlistNeedsRepair()has no avatar condition). A playlist with an empty avatar keeps the client polling for the full 12 rounds for nothing, and no refresh can ever clear it. - No fallback for a broken image:
PlaylistVideoRow(components/playlist-video-row.tsx) renders<img src=...>with noonErrorhandling, so a thumbnail URL that 404s or times out leaves an empty tile.PlaylistCardhas the fallback (failedThumbnail+onError); the row component doesn't. - Failed resolves are silent:
VideoMetadataResolver.resolvemarks an extraction failure as retryable, but the repair gives up after one retry (3 s) and moves on; there is no log line or counter that says how many rows were left incomplete. - Not verified: whether the stored thumbnail URLs themselves expire or are blocked at the image proxy for some providers (BiliBili / NicoNico use different hosts). A repro with the browser's network tab on a failing tile would settle it; I did not have access to one.
Suggested fix
- Add a freshness policy to the repair: refresh a row when
viewCount <= 0or the row is older than N days (e.g. track ametadata_refreshed_at), not only when fields are empty. - Let repair run per requested playlist instead of per user (the 5-minute cooldown is the bottleneck), keep the batch limit but report remaining work (e.g. a header or field
metadataPending: n) so the client can keep polling exactly while there is work. - Align
needsMetadata(frontend) withplaylistNeedsRepair()(server), or addchannelAvatarto the server side. - Add
onErrorfallback (proxied thumbnail from the video id, or the placeholder) toPlaylistVideoRow. - Log repair outcomes (
attempted/updated/failed) at info level.
AI disclosure: This issue was prepared with assistance from an AI system. The observations and proposed fixes are based on static code reading and should be reviewed and validated by the maintainers.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity