Skip to content
Snippets Groups Projects
Commit e94ba05e authored by rinpatch's avatar rinpatch
Browse files

Connection pool: Fix a possible infinite recursion if the pool is exhausted

parent 7738fbba
No related branches found
No related tags found
No related merge requests found
......@@ -14,16 +14,14 @@ def init(_opts) do
)
end
def start_worker(opts) do
def start_worker(opts, retry \\ false) do
case DynamicSupervisor.start_child(__MODULE__, {Pleroma.Gun.ConnectionPool.Worker, opts}) do
{:error, :max_children} ->
case free_pool() do
:ok ->
start_worker(opts)
:error ->
:telemetry.execute([:pleroma, :connection_pool, :provision_failure], %{opts: opts})
{:error, :pool_full}
if retry or free_pool() == :error do
:telemetry.execute([:pleroma, :connection_pool, :provision_failure], %{opts: opts})
{:error, :pool_full}
else
start_worker(opts, true)
end
res ->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment