1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Workers.RemoteFetcherWorker do
6 alias Pleroma.Object.Fetcher
8 use Pleroma.Workers.WorkerHelper, queue: "remote_fetcher"
11 def perform(%Job{args: %{"op" => "fetch_remote", "id" => id} = args}) do
12 case Fetcher.fetch_object_from_id(id, depth: args["depth"]) do
16 {:error, :forbidden} ->
17 {:discard, :forbidden}
19 {:error, :not_found} ->
20 {:discard, :not_found}
22 {:error, :allowed_depth} ->
23 {:discard, :allowed_depth}
34 def timeout(_job), do: :timer.seconds(10)