dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 44aceb9da97ce29544ff8c74488f0a8753d29a52
parent 1f4ffc6c06d53aaabda38f52f096616382a9a41b
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Mon, 22 Sep 2025 22:54:33 +0200

libspotify: retry on error

Diffstat:
Mscripts/libspotify.rb | 9++++++++-
Mspotify/spot-last-checked | 2+-
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/libspotify.rb b/scripts/libspotify.rb @@ -97,7 +97,14 @@ class SpotifyClient def url_call_get(url) request = Net::HTTP::Get.new(url) request["Authorization"] = "Bearer #{@token}" - resp = @http.request(request) + begin + resp = @http.request(request) + rescue + puts("Connection broke, retrying request to #{url}") + sleep(2) + return url_call_get(url) + end + if resp.code_type == Net::HTTPTooManyRequests wait_seconds = resp["Retry-After"].to_i wait_min = wait_seconds / 60 diff --git a/spotify/spot-last-checked b/spotify/spot-last-checked @@ -1 +1 @@ ---- 2025-08-31 +--- 2025-09-21