From 9d77c403cc631a65959ddecaa07450deb378687f Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Wed, 15 Apr 2026 20:37:20 -0700 Subject: [PATCH] Fix Spotify enrichment worker infinite loop on pre-matched artists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Artists with an existing spotify_artist_id but NULL spotify_match_status were fetched by the priority queue every ~3 seconds. _process_artist returned early (preserving the ID) without marking the status, so the same artist was re-queued indefinitely — burning CPU and inflating API call counters. Now marks the artist as 'matched' on the early-return path. --- core/spotify_worker.py | 1 + webui/static/helper.js | 1 + 2 files changed, 2 insertions(+) diff --git a/core/spotify_worker.py b/core/spotify_worker.py index 28beaf5f..f51e78a5 100644 --- a/core/spotify_worker.py +++ b/core/spotify_worker.py @@ -455,6 +455,7 @@ class SpotifyWorker: existing_id = self._get_existing_id('artist', artist_id) if existing_id: logger.debug(f"Preserving existing Spotify ID for artist '{artist_name}': {existing_id}") + self._mark_status('artist', artist_id, 'matched') return results = self.client.search_artists(artist_name, limit=5) diff --git a/webui/static/helper.js b/webui/static/helper.js index 21fbd83d..4e0ba0cf 100644 --- a/webui/static/helper.js +++ b/webui/static/helper.js @@ -3609,6 +3609,7 @@ const WHATS_NEW = { { title: 'Fix Wishlist Dropping Cross-Album Tracks', desc: 'Wishlist cleanup was removing same-titled tracks from different albums even when Allow Duplicates was enabled. Cleanup now respects the setting — same song from different albums can coexist in the wishlist' }, { title: 'Fix "Replace Lower Quality" Setting Not Persisting', desc: 'The import section appeared twice in the settings save payload — the second instance (with only staging_path) overwrote the first (with replace_lower_quality). Merged into a single block' }, { title: 'Inbound Music Request API', desc: 'New POST /api/v1/request endpoint — trigger downloads from Discord bots, Home Assistant, curl, or any external tool. Async with status polling and optional notify_url callback. New "Webhook Received" automation trigger and "Search & Download" action in the Automation Hub' }, + { title: 'Fix Spotify Enrichment Worker Infinite Loop', desc: 'Artists with an existing Spotify ID but no match status got stuck in the enrichment queue — the worker processed them every 3 seconds forever without marking them as done. Now correctly marks them as matched' }, // --- April 14, 2026 --- { date: 'April 14, 2026' },