mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-14 04:52:17 +00:00
Merge branch 'oban/more-improvements' into 'develop'
Oban: more improvements See merge request pleroma/pleroma!4187
This commit is contained in:
commit
f77911f05b
12 changed files with 18 additions and 9 deletions
1
changelog.d/oban-cancel-badreq.change
Normal file
1
changelog.d/oban-cancel-badreq.change
Normal file
|
@ -0,0 +1 @@
|
|||
Publisher jobs will not retry if the error received is a 400
|
1
changelog.d/oban-cancel-poll-result.change
Normal file
1
changelog.d/oban-cancel-poll-result.change
Normal file
|
@ -0,0 +1 @@
|
|||
PollWorker jobs will not retry if the activity no longer exists.
|
1
changelog.d/oban-cancel-receiverworker.change
Normal file
1
changelog.d/oban-cancel-receiverworker.change
Normal file
|
@ -0,0 +1 @@
|
|||
Improved detecting unrecoverable errors for incoming federation jobs
|
0
changelog.d/oban-timeouts.skip
Normal file
0
changelog.d/oban-timeouts.skip
Normal file
|
@ -123,6 +123,7 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
|
|||
Logger.error("Publisher failed to inbox #{inbox} with status #{code}")
|
||||
|
||||
case response do
|
||||
%{status: 400} -> {:cancel, :bad_request}
|
||||
%{status: 403} -> {:cancel, :forbidden}
|
||||
%{status: 404} -> {:cancel, :not_found}
|
||||
%{status: 410} -> {:cancel, :not_found}
|
||||
|
|
|
@ -453,7 +453,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
|||
) do
|
||||
orig_object_ap_id = updated_object["id"]
|
||||
orig_object = Object.get_by_ap_id(orig_object_ap_id)
|
||||
orig_object_data = orig_object.data
|
||||
orig_object_data = Map.get(orig_object, :data)
|
||||
|
||||
updated_object =
|
||||
if meta[:local] do
|
||||
|
|
|
@ -40,5 +40,5 @@ defmodule Pleroma.Workers.BackgroundWorker do
|
|||
end
|
||||
|
||||
@impl Oban.Worker
|
||||
def timeout(_job), do: :timer.seconds(5)
|
||||
def timeout(_job), do: :timer.seconds(15)
|
||||
end
|
||||
|
|
|
@ -17,6 +17,9 @@ defmodule Pleroma.Workers.PollWorker do
|
|||
with %Activity{} = activity <- find_poll_activity(activity_id),
|
||||
{:ok, notifications} <- Notification.create_poll_notifications(activity) do
|
||||
Notification.stream(notifications)
|
||||
else
|
||||
{:error, :poll_activity_not_found} = e -> {:cancel, e}
|
||||
e -> {:error, e}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -47,11 +47,13 @@ defmodule Pleroma.Workers.ReceiverWorker do
|
|||
case errors do
|
||||
{:error, :origin_containment_failed} -> {:cancel, :origin_containment_failed}
|
||||
{:error, :already_present} -> {:cancel, :already_present}
|
||||
{:error, {:validate_object, reason}} -> {:cancel, reason}
|
||||
{:error, {:error, {:validate, reason}}} -> {:cancel, reason}
|
||||
{:error, {:reject, reason}} -> {:cancel, reason}
|
||||
{:error, {:validate_object, _} = reason} -> {:cancel, reason}
|
||||
{:error, {:error, {:validate, {:error, _changeset} = reason}}} -> {:cancel, reason}
|
||||
{:error, {:reject, _} = reason} -> {:cancel, reason}
|
||||
{:signature, false} -> {:cancel, :invalid_signature}
|
||||
{:error, {:error, reason = "Object has been deleted"}} -> {:cancel, reason}
|
||||
{:error, "Object has been deleted"} = reason -> {:cancel, reason}
|
||||
{:error, {:side_effects, {:error, :no_object_actor}} = reason} -> {:cancel, reason}
|
||||
{:error, :not_found} = reason -> {:cancel, reason}
|
||||
{:error, _} = e -> e
|
||||
e -> {:error, e}
|
||||
end
|
||||
|
|
|
@ -31,5 +31,5 @@ defmodule Pleroma.Workers.RemoteFetcherWorker do
|
|||
end
|
||||
|
||||
@impl Oban.Worker
|
||||
def timeout(_job), do: :timer.seconds(10)
|
||||
def timeout(_job), do: :timer.seconds(15)
|
||||
end
|
||||
|
|
|
@ -13,5 +13,5 @@ defmodule Pleroma.Workers.UserRefreshWorker do
|
|||
end
|
||||
|
||||
@impl Oban.Worker
|
||||
def timeout(_job), do: :timer.seconds(5)
|
||||
def timeout(_job), do: :timer.seconds(15)
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ defmodule Pleroma.Workers.ReceiverWorkerTest do
|
|||
|
||||
with_mock Pleroma.Web.ActivityPub.Transmogrifier,
|
||||
handle_incoming: fn _ -> {:reject, "MRF"} end do
|
||||
assert {:cancel, "MRF"} =
|
||||
assert {:cancel, {:reject, "MRF"}} =
|
||||
ReceiverWorker.perform(%Oban.Job{
|
||||
args: %{"op" => "incoming_ap_doc", "params" => params}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue