commit: 7ebca7ecfa93f41d9eac2dcefa4b2e55f1b0c4ac
parent 77949d4590b2a82ef6bb4c79f0777962991e28b1
Author: Mark Felder <feld@feld.me>
Date: Fri, 29 Dec 2023 00:25:33 -0500
Activity publishing failures will prevent the job from retrying if the publishing request returns a 403 or 410
Diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/changelog.d/publisher_discard.change b/changelog.d/publisher_discard.change
@@ -0,0 +1 @@
+Activity publishing failures will prevent the job from retrying if the publishing request returns a 403 or 410
diff --git a/lib/pleroma/web/activity_pub/publisher.ex b/lib/pleroma/web/activity_pub/publisher.ex
@@ -117,11 +117,16 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
result
else
- {_post_result, response} = e ->
+ {_post_result, %{status: code} = response} = e ->
unless params[:unreachable_since], do: Instances.set_unreachable(inbox)
Logger.metadata(activity: id, inbox: inbox, 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