Uniform interface of lastfm refresh async function
This commit is contained in:
@@ -266,10 +266,10 @@ defmodule MusicLibrary.Artists do
|
||||
end
|
||||
end
|
||||
|
||||
@spec refresh_lastfm_data_async(String.t()) ::
|
||||
@spec refresh_lastfm_data_async(ArtistInfo.t()) ::
|
||||
{:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()}
|
||||
def refresh_lastfm_data_async(artist_id) do
|
||||
enqueue_worker(Worker.FetchArtistLastFmData, %{"id" => artist_id})
|
||||
def refresh_lastfm_data_async(artist_info) do
|
||||
enqueue_worker(Worker.FetchArtistLastFmData, %{"id" => artist_info.id})
|
||||
end
|
||||
|
||||
@spec refresh_artist_info_async(String.t()) ::
|
||||
|
||||
@@ -33,7 +33,7 @@ defmodule MusicLibrary.Artists.Batch do
|
||||
@spec refresh_lastfm_data() :: {:ok, [String.t()]}
|
||||
def refresh_lastfm_data do
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user