defmodule GitGud.Workflows.Workers.ScheduleTick do
@moduledoc """
Fires the `on: schedule` crons due this minute
(`GitGud.Workflows.Schedules.fire_due/1`). Runs every minute via the
Oban cron plugin (`config.exs`); `"at"` (ISO 8601) overrides the clock,
for tests.
One attempt: a retry would come after the minute it was for.
"""
use Oban.Worker, queue: :ci, max_attempts: 1
alias GitGud.Workflows.Schedules
@impl Oban.Worker
def perform(%Oban.Job{args: args}) do
at =
case args do
%{"at" => iso} ->
{:ok, at, _offset} = DateTime.from_iso8601(iso)
at
_ ->
DateTime.utc_now()
end
_runs = Schedules.fire_due(at)
:ok
end
end
neiam
/gitgud
Git Gud
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
1
Log in to mark this repository.
722 B · text
History
b868907