From d8cc2f5f019ca1fbae1309e47f2061e14828104f Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Tue, 26 May 2026 16:25:25 -0700 Subject: [PATCH] =?UTF-8?q?Last.fm=20radio=20cache=20cap:=205=20=E2=86=92?= =?UTF-8?q?=2010?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User-visible behavior: at most 10 mirrored Last.fm Radio rows exist at any time. When the cache prunes the 11th-newest + older lastfm_radio rows, the existing cascade-delete hook (``_cascade_delete_mirrored_for_mbids``) removes their matching ``source='lastfm'`` mirror rows in the same transaction. 5 was too aggressive — users seeding multiple radios in a row were losing earlier downloads' provenance before they had time to act on the tracks. 10 gives a few weeks of breathing room without letting the Mirrored tab balloon. --- core/listenbrainz_manager.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/listenbrainz_manager.py b/core/listenbrainz_manager.py index dda2536b..3fd124a8 100644 --- a/core/listenbrainz_manager.py +++ b/core/listenbrainz_manager.py @@ -418,13 +418,17 @@ class ListenBrainzManager: # the new rolling series mirrors (Phase 1c.2.1). self._cleanup_per_period_series_mirrors(cursor) - # For each playlist type, keep only the N most recent - # lastfm_radio keeps fewer since they're auto-regenerated weekly + # For each playlist type, keep only the N most recent. + # Last.fm radios are per-seed-track snapshots that don't update + # on the Last.fm side — capping the cache (and via the cascade + # below, the matching mirror rows) keeps the Mirrored tab from + # accumulating one row per random seed track the user ever + # picked. 10 is the user-facing limit. playlist_type_limits = { 'created_for': 25, 'user': 25, 'collaborative': 25, - 'lastfm_radio': 5, + 'lastfm_radio': 10, } for playlist_type, keep_count in playlist_type_limits.items():