Run the image import sequentially

Changed this for debug as many images are huge and were tripping the
logic off - the whole importer logic needs to be
restructured for better parallelism.
This commit is contained in:
Claudio Ortolina
2024-09-16 14:46:16 +01:00
parent 04755eb5fe
commit 74e7d27ba4
+6 -10
View File
@@ -73,16 +73,12 @@ defmodule MusicLibrary.Records.Importer do
def import_all_cover_images do
Rec
|> MusicLibrary.Repo.all()
|> Task.async_stream(
fn r ->
if r.image_data == nil do
import_cover_image(r)
IO.puts("Imported cover image for #{r.title}")
end
end,
timeout: 10_000
)
|> Stream.run()
|> Enum.each(fn r ->
if r.image_data == nil do
import_cover_image(r)
IO.puts("Imported cover image for #{r.title}")
end
end)
end
def import_all do