Recalculate record embedding after their artist changes
This commit is contained in:
@@ -6,7 +6,15 @@ defmodule MusicLibrary.Worker.FetchArtistInfo do
|
||||
with {:ok, _artist_info} <- MusicLibrary.Artists.fetch_artist_info(artist_id),
|
||||
{:ok, _artist_info} <- MusicLibrary.Artists.fetch_wikipedia_data(artist_id),
|
||||
{:ok, _artist_info} <- MusicLibrary.Artists.fetch_image(artist_id) do
|
||||
:ok
|
||||
regenerate_record_embeddings(artist_id)
|
||||
end
|
||||
end
|
||||
|
||||
defp regenerate_record_embeddings(artist_id) do
|
||||
artist_id
|
||||
|> MusicLibrary.Records.get_artist_records()
|
||||
|> Enum.each(fn record ->
|
||||
MusicLibrary.Records.generate_embedding_async(record)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user