- Update .tool-versions to elixir 1.20.0-otp-29 / erlang 29.0.1 - Update all hex dependencies - Remove unused aliases in path_compute.ex and rover_planning_live/show.ex - Fix Oban unique states to include :suspended (use :incomplete group)
28 lines
933 B
Elixir
28 lines
933 B
Elixir
defmodule Microwaveprop.Workers.PropagationPruneWorker do
|
|
@moduledoc """
|
|
Standalone worker that prunes stale rows from `propagation_scores`.
|
|
|
|
Pruning used to be tacked on to the end of `PropagationGridWorker.perform/1`,
|
|
which meant it only ran after a successful grid compute. When the compute
|
|
worker was being killed mid-run (OOM / SIGTERM), prune never ran and the
|
|
table grew unbounded. Running prune on its own cron keeps the table healthy
|
|
regardless of the compute worker's state.
|
|
"""
|
|
|
|
use Oban.Worker,
|
|
queue: :propagation,
|
|
# Lower priority than PropagationGridWorker so the hourly chain
|
|
# never waits behind a pending prune on the shared :propagation
|
|
# queue (2 slots).
|
|
priority: 5,
|
|
max_attempts: 3,
|
|
unique: [period: 300, states: :incomplete]
|
|
|
|
alias Microwaveprop.Propagation
|
|
|
|
@impl Oban.Worker
|
|
def perform(%Oban.Job{}) do
|
|
Propagation.prune_old_scores()
|
|
:ok
|
|
end
|
|
end
|