From ac55764599c054a03299470d92fd0d274509a024 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 22 Feb 2024 14:07:46 -0500 Subject: Gun Connection Pool was not attempting to free a connection and retry once if the pool was full. --- lib/pleroma/gun/connection_pool/worker_supervisor.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pleroma/gun/connection_pool/worker_supervisor.ex b/lib/pleroma/gun/connection_pool/worker_supervisor.ex index 24ad61117..edaffcc25 100644 --- a/lib/pleroma/gun/connection_pool/worker_supervisor.ex +++ b/lib/pleroma/gun/connection_pool/worker_supervisor.ex @@ -21,7 +21,7 @@ defmodule Pleroma.Gun.ConnectionPool.WorkerSupervisor do def start_worker(opts, retry \\ false) do case DynamicSupervisor.start_child(__MODULE__, {Pleroma.Gun.ConnectionPool.Worker, opts}) do {:error, :max_children} -> - funs = [fn -> !retry end, fn -> match?(:error, free_pool()) end] + funs = [fn -> retry end, fn -> match?(:error, free_pool()) end] if Enum.any?(funs, fn fun -> fun.() end) do :telemetry.execute([:pleroma, :connection_pool, :provision_failure], %{opts: opts}) -- cgit v1.2.3 From 72fc41d89196dc76e6c2c1c6213e10cbaadd7d3c Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 22 Feb 2024 14:11:02 -0500 Subject: 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. --- lib/pleroma/web/activity_pub/publisher.ex | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') 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 @@ defmodule Pleroma.Web.ActivityPub.Publisher do _ -> {: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) -- cgit v1.2.3