Fix NexradWorker crash when minute key is missing from args
Jobs enqueued via backfill only have year/month/day/hour — default minute to 0 instead of requiring it in the pattern match.
This commit is contained in:
parent
147ef7dd6b
commit
0edb1bd95a
1 changed files with 2 additions and 1 deletions
|
|
@ -27,7 +27,8 @@ defmodule Microwaveprop.Workers.NexradWorker do
|
||||||
|
|
||||||
@impl Oban.Worker
|
@impl Oban.Worker
|
||||||
def perform(%Oban.Job{args: args}) do
|
def perform(%Oban.Job{args: args}) do
|
||||||
%{"year" => year, "month" => month, "day" => day, "hour" => hour, "minute" => minute} = args
|
%{"year" => year, "month" => month, "day" => day, "hour" => hour} = args
|
||||||
|
minute = Map.get(args, "minute", 0)
|
||||||
{:ok, date} = Date.new(year, month, day)
|
{:ok, date} = Date.new(year, month, day)
|
||||||
{:ok, time} = Time.new(hour, minute, 0)
|
{:ok, time} = Time.new(hour, minute, 0)
|
||||||
{:ok, timestamp} = DateTime.new(date, time, "Etc/UTC")
|
{:ok, timestamp} = DateTime.new(date, time, "Etc/UTC")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue