spotify-player: slow the startup retry loop instead of multiplying it

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-08-15 22:09:33 +01:00
parent efb49deabd
commit 3604875b55

View file

@ -84,10 +84,20 @@ in
# The loop breaks on the first success, so a bigger bound costs nothing.
# The CLI is no help here: `connect --name` resolves names against the Web
# API device list, which doesn't contain the integrated device at all.
#
# Widen it by slowing the delay rather than by adding rounds: each round
# costs up to three Web API calls, and we now share the bundled client ID
# with every other spotify-player/ncspot user, so 60 one-second rounds was
# ~180 requests per launch into a shared rate-limit bucket (429s). 12
# rounds five seconds apart covers the same 60s for a fifth of the calls.
# Both loops in this file are `for _ in 0..5` / `from_secs(1)`; the leading
# indentation is what pins each replacement to initialize_playback.
postPatch = (old.postPatch or "") + ''
substituteInPlace spotify_player/src/client/mod.rs \
--replace-fail " for _ in 0..5 {" \
" for _ in 0..60 {"
" for _ in 0..12 {" \
--replace-fail " let delay = std::time::Duration::from_secs(1);" \
" let delay = std::time::Duration::from_secs(5);"
'';
});
settings = {