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:
@@ -73,16 +73,12 @@ defmodule MusicLibrary.Records.Importer do
|
|||||||
def import_all_cover_images do
|
def import_all_cover_images do
|
||||||
Rec
|
Rec
|
||||||
|> MusicLibrary.Repo.all()
|
|> MusicLibrary.Repo.all()
|
||||||
|> Task.async_stream(
|
|> Enum.each(fn r ->
|
||||||
fn r ->
|
if r.image_data == nil do
|
||||||
if r.image_data == nil do
|
import_cover_image(r)
|
||||||
import_cover_image(r)
|
IO.puts("Imported cover image for #{r.title}")
|
||||||
IO.puts("Imported cover image for #{r.title}")
|
end
|
||||||
end
|
end)
|
||||||
end,
|
|
||||||
timeout: 10_000
|
|
||||||
)
|
|
||||||
|> Stream.run()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def import_all do
|
def import_all do
|
||||||
|
|||||||
Reference in New Issue
Block a user