Remove duplication in implementation
This commit is contained in:
@@ -11,29 +11,25 @@ defmodule MusicLibrary.Artists.Batch do
|
||||
|
||||
@spec refresh_musicbrainz_data() :: {:ok, [String.t()]}
|
||||
def refresh_musicbrainz_data do
|
||||
Batch.run_on_all(from(r in ArtistInfo), "artist_info", fn artist_info ->
|
||||
Artists.refresh_musicbrainz_data_async(artist_info)
|
||||
end)
|
||||
batch(&Artists.refresh_musicbrainz_data_async/1)
|
||||
end
|
||||
|
||||
@spec refresh_discogs_data() :: {:ok, [String.t()]}
|
||||
def refresh_discogs_data do
|
||||
Batch.run_on_all(from(r in ArtistInfo), "artist_info", fn artist_info ->
|
||||
Artists.refresh_discogs_data_async(artist_info)
|
||||
end)
|
||||
batch(&Artists.refresh_discogs_data_async/1)
|
||||
end
|
||||
|
||||
@spec refresh_wikipedia_data() :: {:ok, [String.t()]}
|
||||
def refresh_wikipedia_data do
|
||||
Batch.run_on_all(from(r in ArtistInfo), "artist_info", fn artist_info ->
|
||||
Artists.refresh_wikipedia_data_async(artist_info)
|
||||
end)
|
||||
batch(&Artists.refresh_wikipedia_data_async/1)
|
||||
end
|
||||
|
||||
@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)
|
||||
end)
|
||||
batch(&Artists.refresh_lastfm_data_async/1)
|
||||
end
|
||||
|
||||
defp batch(callback) do
|
||||
Batch.run_on_all(from(r in ArtistInfo), "artist_info", callback)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user