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:
parent
c9d1abafda
commit
eeb92bcc19
2 changed files with 14 additions and 5 deletions
|
|
@ -13,7 +13,7 @@ defmodule Microwaveprop.Workers.BackfillEnqueueWorker do
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@enrichable [:pending, :failed]
|
@enrichable [:pending, :queued, :failed]
|
||||||
|
|
||||||
@impl Oban.Worker
|
@impl Oban.Worker
|
||||||
def perform(%Oban.Job{args: %{"limit" => limit}}) do
|
def perform(%Oban.Job{args: %{"limit" => limit}}) do
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,16 @@ defmodule Microwaveprop.Workers.ContactWeatherEnqueueWorker do
|
||||||
end
|
end
|
||||||
|
|
||||||
ids = [contact.id]
|
ids = [contact.id]
|
||||||
if contact.pos1, do: Radio.mark_weather_queued!(ids)
|
|
||||||
if contact.pos1, do: Radio.mark_hrrr_queued!(ids)
|
if contact.pos1 do
|
||||||
if contact.pos1 && contact.pos2, do: Radio.mark_terrain_queued!(ids)
|
mark_status!(ids, :weather_status, weather_jobs)
|
||||||
if contact.pos1, do: Radio.mark_iemre_queued!(ids)
|
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
|
:ok
|
||||||
end
|
end
|
||||||
|
|
@ -262,4 +268,7 @@ defmodule Microwaveprop.Workers.ContactWeatherEnqueueWorker do
|
||||||
|> Enum.chunk_every(@insert_batch_size)
|
|> Enum.chunk_every(@insert_batch_size)
|
||||||
|> Enum.each(&Oban.insert_all/1)
|
|> Enum.each(&Oban.insert_all/1)
|
||||||
end
|
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
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue