X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fworkers%2Fpublisher.ex;h=c890ffb79b4c00a44ac32412dbb7f711fad4efc3;hb=0e1c481a94392b69833fbe6afc184ebbd90e1330;hp=6397948308c5983b79a256f37eb44c529ec4b394;hpb=23d279e03ee1f7a1285614754738711359bc4b81;p=akkoma diff --git a/lib/pleroma/workers/publisher.ex b/lib/pleroma/workers/publisher.ex index 639794830..c890ffb79 100644 --- a/lib/pleroma/workers/publisher.ex +++ b/lib/pleroma/workers/publisher.ex @@ -3,12 +3,21 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.Publisher do - use Oban.Worker, queue: "federator_outgoing", max_attempts: 5 + alias Pleroma.Activity + alias Pleroma.Web.Federator + + # Note: `max_attempts` is intended to be overridden in `new/1` call + use Oban.Worker, + queue: "federator_outgoing", + max_attempts: Pleroma.Config.get([:workers, :retries, :compile_time_default]) @impl Oban.Worker - def perform(%Oban.Job{args: %{module: module_name, params: params}}) do - module_name - |> String.to_atom() - |> apply(:publish_one, [params]) + def perform(%{"op" => "publish", "activity_id" => activity_id}) do + activity = Activity.get_by_id(activity_id) + Federator.perform(:publish, activity) + end + + def perform(%{"op" => "publish_one", "module" => module_name, "params" => params}) do + Federator.perform(:publish_one, String.to_atom(module_name), params) end end