diff --git a/Dockerfile b/Dockerfile index ed0150e..3a12cfe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -87,7 +87,7 @@ RUN mix release FROM ${RUNNER_IMAGE} AS runner # Runtime deps only — no compilers, no -dev packages -RUN apk add --no-cache libstdc++ openssl ncurses-libs vips +RUN apk add --no-cache libstdc++ openssl ncurses-libs vips vips-heif WORKDIR /app diff --git a/lib/berrypod/images/variant_cache.ex b/lib/berrypod/images/variant_cache.ex index 24024c7..8fdd761 100644 --- a/lib/berrypod/images/variant_cache.ex +++ b/lib/berrypod/images/variant_cache.ex @@ -75,33 +75,9 @@ defmodule Berrypod.Images.VariantCache do if to_process == [] do Logger.info("[VariantCache] All database image variants up to date") else - Logger.info( - "[VariantCache] Processing #{length(to_process)} images with missing variants..." - ) + Logger.info("[VariantCache] Enqueueing #{length(to_process)} images with missing variants") - # Process directly instead of round-tripping through Oban — more reliable at startup - to_process - |> Task.async_stream( - fn {id, _source_width} -> - case Optimizer.process_for_image(id) do - {:ok, _} -> - :ok - - {:error, reason} -> - Logger.warning("[VariantCache] Failed to process #{id}: #{inspect(reason)}") - end - end, - max_concurrency: 4, - timeout: :timer.seconds(30), - on_timeout: :kill_task - ) - |> Enum.count(fn - {:ok, :ok} -> true - _ -> false - end) - |> then(fn count -> - Logger.info("[VariantCache] Processed #{count}/#{length(to_process)} image variants") - end) + Enum.each(to_process, fn {id, _source_width} -> OptimizeWorker.enqueue(id) end) end end