inspiredby: Spotify ban fixed, LLM reader paused
Why: The hourly worker had been stuck for hours in a Spotify 429 loop. At the same time Damien's Claude usage jumped from 12% to 87% of a 5-hour block in minutes.
These were two separate problems that happened at the same time. Spotify had banned the music-discovery client, which inspiredby shares, for 14 hours. We kept knocking every two minutes anyway. The usage jump came from the inspiredby LLM reader (Claude Haiku through claude -p) together with a long Opus dev session. The Spotify calls are plain Python and use no Claude tokens.
1. Spotify: obey long Retry-After
Spotify answered with Retry-After: 50233, about 14 hours. inspiredby/http.py capped every wait at 120 s and retried. Each failed task was then followed by the next Spotify task doing the same thing. On top of that, every hourly seed re-queued the same songs under shifted task keys, leaving 22,173 pending lookups for 9,507 songs.
- Action: A Retry-After longer than 120 s, or a 429 that survives all retries (1 h), now records the host in
/home/plex/inspiredby/.cache/blocked_hosts.json. Later requests from the worker or the website raiseRateLimitedand send nothing. I pre-seededapi.spotify.comuntil 15:04 PDT. - Action: The queue treats a rate-limited task as not the task's fault: no attempt is counted, it waits until the ban ends, and its kind is skipped for the rest of that run. Spotify matching is capped at 10 tasks (200 searches) per run, paced at 1 s.
- Action: The Spotify seed now skips songs already waiting in a task. I re-queued production cleanly (437 tasks covering 8,729 songs) and marked the 676 duplicate tasks
dropped. - Verified: the next worker runs logged "spotify paused … until 15:04" and sent zero requests.
2. LLM reader paused
Each hourly reader run reads 100 pages in about 20 minutes and uses about 1M Haiku tokens: roughly 667k in and 356k out, most of the output being thinking. That is $3.07 notional per run, against an estimate of about $0.50. On a Claude Pro plan that is far too expensive. I set the reader's built-in kill switch, which survives deploys and reboots (deploy.sh re-enables the timer):
- Action:
INSPIREDBY_LLM_READER=offin/home/plex/inspiredby/.env. I also stoppedinspiredby-reader.timer. Its runs are now no-ops even if the timer starts again. - Next: measure the cost against Damien's
/usagenumbers with one manual run, and test Gemini Flash as the reader on the 69 graded pages.
3. Genius API key
I moved Damien's new Genius API client into /home/plex/inspiredby/.env (mode 600) as GENIUS_CLIENT_ID, GENIUS_CLIENT_SECRET, GENIUS_CLIENT_ACCESS_TOKEN and GENIUS_REDIRECT_URI, and deleted the loose file from the repo checkout.
Net effect: the worker drains its queue again without hammering Spotify, and no background job spends Claude usage until the reader's cost is measured.
← Back to Admin Hub