prop/lib/microwaveprop/workers/rover_mission_backfill_worker.ex
Graham McIntire c2a23d1840
feat(rover-planning): hourly backfill worker recovers stuck paths
Adds RoverPlanning.backfill_paths/0 that walks every mission and
re-enqueues RoverPathProfileWorker jobs for any (rover × station) pair
whose Path is missing or not :complete. The path-profile worker
short-circuits on :complete, so this is idempotent.

Wires a new RoverMissionBackfillWorker into both dev (config.exs) and
prod (runtime.exs) crons at HH:30 — heals missions stuck in :pending
or :failed from transient elevation-API errors or interrupted
create_mission enqueues without operator action.
2026-05-03 13:52:27 -05:00

26 lines
847 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.Worker,
queue: :terrain,
priority: 5,
max_attempts: 3,
unique: [period: 300, states: [:available, :scheduled, :executing, :retryable]]
alias Microwaveprop.RoverPlanning
@impl Oban.Worker
def perform(%Oban.Job{}) do
RoverPlanning.backfill_paths()
end
end