logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 991807080bfb35caf32f2403d61dd6ced66a9a50
parent 72480e7b2fc19beaa8a0a524e8b1c83442debd01
Author: feld <feld@feld.me>
Date:   Fri,  9 Feb 2024 16:48:05 +0000

Merge branch 'gun-fix' into 'develop'

Fix Gun connection supervisor logic error

See merge request pleroma/pleroma!4056

Diffstat:

Achangelog.d/gun_pool.fix1+
Mlib/pleroma/gun/connection_pool/worker_supervisor.ex4+++-
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/changelog.d/gun_pool.fix b/changelog.d/gun_pool.fix @@ -0,0 +1 @@ +Fix logic error in Gun connection pooling which prevented retries even when the worker was launched with retry = true diff --git a/lib/pleroma/gun/connection_pool/worker_supervisor.ex b/lib/pleroma/gun/connection_pool/worker_supervisor.ex @@ -21,7 +21,9 @@ 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} -> - if Enum.any?([retry, free_pool()], &match?(&1, :error)) do + 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}) {:error, :pool_full} else