use Oban for startup variant processing, add vips-heif
VariantCache now enqueues missing variants via OptimizeWorker instead of processing directly with Task.async_stream. Simpler and uses the existing job queue. Adds vips-heif to Docker runtime for HEIF support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
19d8c7d0fd
commit
75b9ff3156
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user