prop/lib/microwaveprop/workers/rover_mission_backfill_worker.ex
2026-06-16 12:38:08 -05:00

26 lines
818 B
Elixir
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

defmodule Microwaveprop.Workers.RoverMissionBackfillWorker do
@moduledoc """
Periodic safety net for the `/rover-planning` matrix. Walks every
mission and re-enqueues `RoverPathProfileWorker` jobs for any
`(rover_location × station)` pair whose `Path` is missing or not
`:complete`. The path-profile worker short-circuits on `:complete`,
so this is idempotent across runs.
Recovers from transient failures (elevation API blips, rolling
deploys that interrupted the original `create_mission` enqueue)
without operator action.
"""
use Oban.Pro.Worker,
queue: :terrain,
priority: 5,
max_attempts: 3,
unique: [period: 300, states: :incomplete]
alias Microwaveprop.RoverPlanning
@impl Oban.Pro.Worker
def process(%Oban.Job{}) do
RoverPlanning.backfill_paths()
end
end