On-demand metadata refresh can duplicate the leader's work #25
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context: multi-replica stateless deployment (two 2-replica apps,
cheeztvandfafflix, each one PostgreSQL plus valkey, no sticky sessions). Not a 12.0 regression — live in the deployed build. Tracking: #12.Problem
MediaBrowser.Providers/Manager/ProviderManager.cs:65,67keeps_refreshQueueand_activeRefreshesprocess-local, and on-demand refresh is not gated on the scan leader.Two pods asked to refresh the same item — or one pod's on-demand refresh racing the scan leader's scheduled refresh — each make the provider calls and each write the result. Duplicated work and provider quota, plus racing writes to the same item rows.
Lowest priority in #12: the outcome is wasted work rather than wrong data, and the overlap window is short.
Proposal
SET NXwith a TTL) around the refresh, so a second pod skips or waits. Smaller change, keeps refresh latency local.Acceptance
PostgreSqlTestServerintests/Jellyfin.Server.Testsand run in thepostgres-migration-chainWoodpecker step (JELLYFIN_TEST_POSTGRES). In-memory providers have hidden different semantics and are how three bugs reached production.