Uniform interface of lastfm refresh async function

This commit is contained in:
Claudio Ortolina
2026-04-25 21:30:06 +01:00
parent 9f8ef6c329
commit d4132d8851
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -266,10 +266,10 @@ defmodule MusicLibrary.Artists do
end end
end end
@spec refresh_lastfm_data_async(String.t()) :: @spec refresh_lastfm_data_async(ArtistInfo.t()) ::
{:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()} {:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()}
def refresh_lastfm_data_async(artist_id) do def refresh_lastfm_data_async(artist_info) do
enqueue_worker(Worker.FetchArtistLastFmData, %{"id" => artist_id}) enqueue_worker(Worker.FetchArtistLastFmData, %{"id" => artist_info.id})
end end
@spec refresh_artist_info_async(String.t()) :: @spec refresh_artist_info_async(String.t()) ::
+1 -1
View File
@@ -33,7 +33,7 @@ defmodule MusicLibrary.Artists.Batch do
@spec refresh_lastfm_data() :: {:ok, [String.t()]} @spec refresh_lastfm_data() :: {:ok, [String.t()]}
def refresh_lastfm_data do def refresh_lastfm_data do
Batch.run_on_all(from(r in ArtistInfo), "artist_info", fn artist_info -> Batch.run_on_all(from(r in ArtistInfo), "artist_info", fn artist_info ->
Artists.refresh_lastfm_data_async(artist_info.id) Artists.refresh_lastfm_data_async(artist_info)
end) end)
end end
end end