Merge branch 'gun-pool-retry' into 'develop'
Gun connection pooling: rename variable for clarity See merge request pleroma/pleroma!4078
This commit is contained in:
commit
6144cb43a8
|
@ -18,10 +18,10 @@ def init(_opts) do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_worker(opts, retry \\ false) do
|
def start_worker(opts, last_attempt \\ 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} ->
|
||||||
funs = [fn -> retry end, fn -> match?(:error, free_pool()) end]
|
funs = [fn -> last_attempt end, fn -> match?(:error, free_pool()) end]
|
||||||
|
|
||||||
if Enum.any?(funs, fn fun -> fun.() end) do
|
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})
|
||||||
|
|
Loading…
Reference in New Issue