Merge branch 'gun-fix' into 'develop'
Fix Gun connection supervisor logic error See merge request pleroma/pleroma!4056
This commit is contained in:
commit
991807080b
|
@ -0,0 +1 @@
|
||||||
|
Fix logic error in Gun connection pooling which prevented retries even when the worker was launched with retry = true
|
|
@ -21,7 +21,9 @@ def init(_opts) do
|
||||||
def start_worker(opts, retry \\ false) do
|
def start_worker(opts, retry \\ false) do
|
||||||
case DynamicSupervisor.start_child(__MODULE__, {Pleroma.Gun.ConnectionPool.Worker, opts}) do
|
case DynamicSupervisor.start_child(__MODULE__, {Pleroma.Gun.ConnectionPool.Worker, opts}) do
|
||||||
{:error, :max_children} ->
|
{: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})
|
:telemetry.execute([:pleroma, :connection_pool, :provision_failure], %{opts: opts})
|
||||||
{:error, :pool_full}
|
{:error, :pool_full}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue