fix(coverage): replace String.to_existing_atom with explicit status mapping

The status atoms (:computing, :queued, :ready, :failed) may not be
interned in the worker process when it broadcasts. Map status strings
to atoms explicitly instead of relying on prior interning.
This commit is contained in:
Graham McIntire 2026-05-06 15:46:55 -05:00
parent ef4a4c99b5
commit 4191f2dc05

View file

@ -267,10 +267,16 @@ defmodule Towerops.Workers.CoverageWorker do
defp update_progress(coverage, status, pct) do
{:ok, updated} = Coverages.mark_status(coverage, status, %{progress_pct: pct})
Coverages.broadcast(updated, {:coverage_status, String.to_existing_atom(status), pct})
Coverages.broadcast(updated, {:coverage_status, status_atom(status), pct})
updated
end
defp status_atom("draft"), do: :draft
defp status_atom("queued"), do: :queued
defp status_atom("computing"), do: :computing
defp status_atom("ready"), do: :ready
defp status_atom("failed"), do: :failed
defp finalize(coverage, %{tif: tif, png: png, bbox: {min_lat, min_lon, max_lat, max_lon}}) do
{:ok, updated} =
Coverages.mark_status(coverage, "ready", %{