The ap_id is a URL, so we can just pass that to set_reachable/1
Also only bother attempting to mark reachable if it was known to be unreachable
This commit is contained in:
parent
b87ec49972
commit
0f667761a9
1 changed files with 3 additions and 7 deletions
|
|
@ -12,13 +12,9 @@ defmodule Pleroma.Workers.RemoteFetcherWorker do
|
||||||
def perform(%Job{args: %{"op" => "fetch_remote", "id" => id} = args}) do
|
def perform(%Job{args: %{"op" => "fetch_remote", "id" => id} = args}) do
|
||||||
case Fetcher.fetch_object_from_id(id, depth: args["depth"]) do
|
case Fetcher.fetch_object_from_id(id, depth: args["depth"]) do
|
||||||
{:ok, _object} ->
|
{:ok, _object} ->
|
||||||
# Mark the server as reachable since we successfully fetched an object
|
unless Instances.reachable?(id) do
|
||||||
case URI.parse(id) do
|
# Mark the server as reachable since we successfully fetched an object
|
||||||
%URI{host: host} when not is_nil(host) ->
|
Instances.set_reachable(id)
|
||||||
Instances.set_reachable("https://#{host}")
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
:ok
|
|
||||||
end
|
end
|
||||||
|
|
||||||
:ok
|
:ok
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue