Fix HRRR enrichment status stuck at queued/pending

enqueue_for_contact unconditionally marked contacts as :queued even
when no HRRR jobs were needed (profiles already exist). Workers never
updated contact status to :complete after storing profiles. Contacts
got stuck and were never re-processed.

- Mark :complete when no jobs generated (data already exists)
- Include :queued in backfill enrichable states for reconciliation
This commit is contained in:
Graham McIntire 2026-04-06 10:24:49 -05:00
parent c9d1abafda
commit eeb92bcc19
2 changed files with 14 additions and 5 deletions

View file

@ -13,7 +13,7 @@ defmodule Microwaveprop.Workers.BackfillEnqueueWorker do
require Logger
@enrichable [:pending, :failed]
@enrichable [:pending, :queued, :failed]
@impl Oban.Worker
def perform(%Oban.Job{args: %{"limit" => limit}}) do

View file

@ -33,10 +33,16 @@ defmodule Microwaveprop.Workers.ContactWeatherEnqueueWorker do
end
ids = [contact.id]
if contact.pos1, do: Radio.mark_weather_queued!(ids)
if contact.pos1, do: Radio.mark_hrrr_queued!(ids)
if contact.pos1 && contact.pos2, do: Radio.mark_terrain_queued!(ids)
if contact.pos1, do: Radio.mark_iemre_queued!(ids)
if contact.pos1 do
mark_status!(ids, :weather_status, weather_jobs)
mark_status!(ids, :hrrr_status, hrrr_jobs)
mark_status!(ids, :iemre_status, iemre_jobs)
end
if contact.pos1 && contact.pos2 do
mark_status!(ids, :terrain_status, terrain_jobs)
end
:ok
end
@ -262,4 +268,7 @@ defmodule Microwaveprop.Workers.ContactWeatherEnqueueWorker do
|> Enum.chunk_every(@insert_batch_size)
|> Enum.each(&Oban.insert_all/1)
end
defp mark_status!(ids, field, [_ | _]), do: Radio.set_enrichment_status!(ids, field, :queued)
defp mark_status!(ids, field, []), do: Radio.set_enrichment_status!(ids, field, :complete)
end