From 72fc41d89196dc76e6c2c1c6213e10cbaadd7d3c Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 22 Feb 2024 14:11:02 -0500 Subject: [PATCH] Prevent publisher jobs from erroring if the connection pool is full A full pool is a soft-error. Snooze the job for 30 seconds and try again. --- changelog.d/gun_pool2.fix | 1 + lib/pleroma/web/activity_pub/publisher.ex | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 changelog.d/gun_pool2.fix diff --git a/changelog.d/gun_pool2.fix b/changelog.d/gun_pool2.fix new file mode 100644 index 000000000..a1f98b49c --- /dev/null +++ b/changelog.d/gun_pool2.fix @@ -0,0 +1 @@ +Connection pool errors when publishing an activity is a soft-error that will be retried shortly. diff --git a/lib/pleroma/web/activity_pub/publisher.ex b/lib/pleroma/web/activity_pub/publisher.ex index c27612697..9e7d00519 100644 --- a/lib/pleroma/web/activity_pub/publisher.ex +++ b/lib/pleroma/web/activity_pub/publisher.ex @@ -129,6 +129,10 @@ def publish_one(%{inbox: inbox, json: json, actor: %User{} = actor, id: id} = pa _ -> {:error, e} end + {:error, :pool_full} -> + Logger.debug("Publisher snoozing worker job due to full connection pool") + {:snooze, 30} + e -> unless params[:unreachable_since], do: Instances.set_unreachable(inbox) Logger.metadata(activity: id, inbox: inbox)