summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2023-12-29 23:18:34 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2023-12-29 23:18:34 +0000
commitf74f5e0a56277507e7bc3df7251ec58b6c8b41cb (patch)
treeb468afa0052d52069e58808d17f3629a9ef13bd7 /lib
parent8ac4458630026387a5394b427daa409b0d2667ba (diff)
parent833117f5738c286864d525aea9a87d1a7c193ff3 (diff)
downloadpleroma-f74f5e0a56277507e7bc3df7251ec58b6c8b41cb.tar.gz
pleroma-f74f5e0a56277507e7bc3df7251ec58b6c8b41cb.zip
Merge branch 'publisher' into 'develop'
Discard some failed publisher jobs See merge request pleroma/pleroma!4022
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/activity_pub/publisher.ex19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/pleroma/web/activity_pub/publisher.ex b/lib/pleroma/web/activity_pub/publisher.ex
index e0dd2e7c9..cc47b3d27 100644
--- a/lib/pleroma/web/activity_pub/publisher.ex
+++ b/lib/pleroma/web/activity_pub/publisher.ex
@@ -117,10 +117,23 @@ 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.error("Failed to publish activity #{id} #{inspect(e)}")
- {:error, response}
+ Logger.metadata(activity: id, inbox: inbox, status: code)
+ Logger.error("Publisher failed to inbox #{inbox} with status #{code}")
+
+ case response do
+ %{status: 403} -> {:discard, :forbidden}
+ %{status: 404} -> {:discard, :not_found}
+ %{status: 410} -> {:discard, :not_found}
+ _ -> {:error, e}
+ end
+
+ e ->
+ unless params[:unreachable_since], do: Instances.set_unreachable(inbox)
+ Logger.metadata(activity: id, inbox: inbox)
+ Logger.error("Publisher failed to inbox #{inbox} #{inspect(e)}")
+ {:error, e}
end
end