Ensure ReachabilityWorker jobs can be scheduled without needing awareness of the phase design
This commit is contained in:
parent
ff5f88aae3
commit
2267ace106
2 changed files with 40 additions and 0 deletions
|
|
@ -24,6 +24,22 @@ defmodule Pleroma.Workers.ReachabilityWorker do
|
|||
end
|
||||
end
|
||||
|
||||
# New jobs enter here and are immediately re-scheduled for the first phase
|
||||
@impl true
|
||||
def perform(%Oban.Job{args: %{"domain" => domain}}) do
|
||||
scheduled_at = DateTime.add(DateTime.utc_now(), 60, :second)
|
||||
|
||||
%{
|
||||
"domain" => domain,
|
||||
"phase" => "phase_1min",
|
||||
"attempt" => 1
|
||||
}
|
||||
|> new(scheduled_at: scheduled_at, replace: true)
|
||||
|> Oban.insert()
|
||||
|
||||
:ok
|
||||
end
|
||||
|
||||
@impl true
|
||||
def timeout(_job), do: :timer.seconds(5)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue