diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2024-02-23 06:47:56 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2024-02-23 06:47:56 +0000 |
commit | 00e828b1a07d8b825eba1b3503651a899400a281 (patch) | |
tree | ae8f6af6f4e355641aff3fb7042832ece89ec449 | |
parent | f0468697cd74f4ec062f9c6feda53cfbe9e4500c (diff) | |
parent | 72fc41d89196dc76e6c2c1c6213e10cbaadd7d3c (diff) | |
download | pleroma-00e828b1a07d8b825eba1b3503651a899400a281.tar.gz pleroma-00e828b1a07d8b825eba1b3503651a899400a281.zip |
Merge branch 'gun-pool-retry' into 'develop'
Gun connection pool retry fix
See merge request pleroma/pleroma!4076
-rw-r--r-- | changelog.d/gun_pool2.fix | 1 | ||||
-rw-r--r-- | lib/pleroma/gun/connection_pool/worker_supervisor.ex | 2 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/publisher.ex | 4 |
3 files changed, 6 insertions, 1 deletions
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/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}) 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) |