Add Instances.check_all_unreachable/0 and Instance.check_unreachable/1

This commit is contained in:
Mark Felder 2025-06-28 12:51:10 -07:00
commit 29f7607910
4 changed files with 85 additions and 0 deletions

View file

@ -24,4 +24,13 @@ defmodule Pleroma.Instances do
url_or_host
end
end
@doc "Schedules reachability checks for all unreachable instances"
def check_all_unreachable do
get_unreachable()
|> Enum.each(fn {domain, _} ->
Pleroma.Workers.ReachabilityWorker.new(%{"domain" => domain})
|> Oban.insert()
end)
end
end

View file

@ -304,4 +304,10 @@ defmodule Pleroma.Instances.Instance do
DeleteWorker.new(%{"op" => "delete_instance", "host" => host})
|> Oban.insert()
end
@doc "Schedules reachability check for instance"
def check_unreachable(domain) when is_binary(domain) do
Pleroma.Workers.ReachabilityWorker.new(%{"domain" => domain})
|> Oban.insert()
end
end