fix(prune): widen profile/score file cutoff from 2h to 3h

HRRR publishes ~2h after the cycle hour, so the hourly seeder uses
run_time = now - 2h. That puts the f00 analysis file's valid_time
right at the 2h prune cutoff — the file was being deleted within
minutes of the Rust analysis step writing it, leaving /weather and
/map point-detail with no data.

A 3h cutoff keeps the current analysis alive until the next hourly
run supersedes it; forecast files (valid_time >> cutoff) are
unaffected.
This commit is contained in:
Graham McIntire 2026-04-20 13:52:47 -05:00
parent 0c1d90ef58
commit 608fd32e5e
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -198,12 +198,18 @@ defmodule Microwaveprop.Propagation do
end
@doc """
Remove score files with valid_times older than 2 hours. Called on
Remove score files with valid_times older than 3 hours. Called on
a cron by `Microwaveprop.Workers.PropagationPruneWorker`.
The cutoff sits one hour beyond HRRR's ~2h publish lag: the hourly
seeder picks `run_time = now - 2h`, so the f00 analysis file is
written at valid_time = now - 2h. A 2h cutoff deletes it within
minutes; a 3h cutoff keeps it alive until the next hourly run
supersedes it.
"""
@spec prune_old_scores() :: :ok
def prune_old_scores do
cutoff = DateTime.add(DateTime.utc_now(), -2, :hour)
cutoff = DateTime.add(DateTime.utc_now(), -3, :hour)
file_deleted = ScoresFile.prune_older_than(cutoff)
profiles_deleted = ProfilesFile.prune_older_than(cutoff)