Activity publishing failures will prevent the job from retrying if the publishing request returns a 403 or 410

This commit is contained in:
Mark Felder 2023-12-29 00:25:33 -05:00
parent 77949d4590
commit 7ebca7ecfa
2 changed files with 8 additions and 2 deletions

View File

@ -0,0 +1 @@
Activity publishing failures will prevent the job from retrying if the publishing request returns a 403 or 410

View File

@ -117,11 +117,16 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
result result
else else
{_post_result, response} = e -> {_post_result, %{status: code} = response} = e ->
unless params[:unreachable_since], do: Instances.set_unreachable(inbox) unless params[:unreachable_since], do: Instances.set_unreachable(inbox)
Logger.metadata(activity: id, inbox: inbox, status: code) Logger.metadata(activity: id, inbox: inbox, status: code)
Logger.error("Publisher failed to inbox #{inbox} with status #{code}") Logger.error("Publisher failed to inbox #{inbox} with status #{code}")
{:error, response}
case response do
%{status: 403} -> {:discard, :forbidden}
%{status: 410} -> {:discard, :not_found}
_ -> {:error, response}
end
end end
end end