Improve retry strategies for Last.fm refresh

This commit is contained in:
Claudio Ortolina
2025-04-06 20:52:57 +01:00
parent 0eba510d65
commit 1d2d72b8ce
2 changed files with 34 additions and 3 deletions
+6 -3
View File
@@ -92,9 +92,12 @@ defmodule LastFm.Refresh do
Feed.update(tracks)
{:noreply, config, config.refresh_interval}
{:error, _reason} ->
# TODO: think about failure scenario - error is logged at the API level
{:noreply, config, config.refresh_interval}
{:error, error} ->
if API.ErrorResponse.retryable_error?(error) do
{:noreply, config, API.ErrorResponse.retry_delay(error)}
else
{:stop, error, config}
end
end
end
end