Add 90-min timeout kill to PropagationGridWorker
This commit is contained in:
parent
6274d03543
commit
ece721e490
1 changed files with 13 additions and 1 deletions
|
|
@ -5,10 +5,12 @@ defmodule Microwaveprop.Workers.PropagationGridWorker do
|
|||
Fetches f00-f18 to provide 18-hour forecast timeline.
|
||||
"""
|
||||
|
||||
# `unique.period` matches the 3-hour cron so a retrying job can't be
|
||||
# duplicated by the next cron firing.
|
||||
use Oban.Worker,
|
||||
queue: :propagation,
|
||||
max_attempts: 3,
|
||||
unique: [period: 3600, states: [:available, :scheduled, :executing, :retryable]]
|
||||
unique: [period: 10_800, states: [:available, :scheduled, :executing, :retryable]]
|
||||
|
||||
alias Microwaveprop.Propagation
|
||||
alias Microwaveprop.Propagation.BandConfig
|
||||
|
|
@ -22,6 +24,16 @@ defmodule Microwaveprop.Workers.PropagationGridWorker do
|
|||
|
||||
require Logger
|
||||
|
||||
# Hard ceiling per run. A healthy run is ~60 min (19 forecast hours × ~3 min
|
||||
# each). 90 min gives 1.5× headroom and is under the 3-hour cron cadence, so
|
||||
# a stuck wgrib2/HTTP call can't block the queue indefinitely. Oban kills
|
||||
# the executing process on timeout, which closes linked ports and cascades
|
||||
# SIGKILL to any child wgrib2 subprocess.
|
||||
@run_timeout_ms 90 * 60 * 1000
|
||||
|
||||
@impl Oban.Worker
|
||||
def timeout(_job), do: @run_timeout_ms
|
||||
|
||||
@max_forecast_hour 18
|
||||
|
||||
@impl Oban.Worker
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue