fix: add error handling to unsupervised Task.start calls in application.ex
- Grid cache warm-up and ML model load now wrapped in try/rescue so silent failures are logged instead of lost
This commit is contained in:
parent
bca2174f71
commit
e8b143813e
1 changed files with 15 additions and 2 deletions
|
|
@ -97,7 +97,15 @@ defmodule Microwaveprop.Application do
|
|||
# master: when executed here the loaded rows live on the app master's
|
||||
# heap and never GC (it's idle after boot), pinning ~800 MiB for the
|
||||
# lifetime of the pod.
|
||||
{:ok, _pid} = Task.start(fn -> Microwaveprop.Weather.warm_grid_cache_from_latest_profile() end)
|
||||
{:ok, _pid} =
|
||||
Task.start(fn ->
|
||||
try do
|
||||
Microwaveprop.Weather.warm_grid_cache_from_latest_profile()
|
||||
rescue
|
||||
e ->
|
||||
Logger.error("Application: grid cache warm failed: #{Exception.format(:error, e, __STACKTRACE__)}")
|
||||
end
|
||||
end)
|
||||
|
||||
# One-shot backfill: enqueue a QRZ-lookup job for every user with a
|
||||
# missing home QTH. Idempotent — the worker no-ops if home_grid is
|
||||
|
|
@ -118,7 +126,12 @@ defmodule Microwaveprop.Application do
|
|||
if Application.get_env(:microwaveprop, :load_ml_model, false) do
|
||||
{:ok, _pid} =
|
||||
Task.start(fn ->
|
||||
try do
|
||||
Microwaveprop.Propagation.load_ml_model()
|
||||
rescue
|
||||
e ->
|
||||
Logger.error("Application: ML model load failed: #{Exception.format(:error, e, __STACKTRACE__)}")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue