projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7738fbb
)
Connection pool: Fix a possible infinite recursion if the pool is exhausted
author
rinpatch
<rinpatch@sdf.org>
Thu, 7 May 2020 13:11:48 +0000
(16:11 +0300)
committer
rinpatch
<rinpatch@sdf.org>
Wed, 15 Jul 2020 12:26:35 +0000
(15:26 +0300)
lib/pleroma/gun/connection_pool/worker_supervisor.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/gun/connection_pool/worker_supervisor.ex
b/lib/pleroma/gun/connection_pool/worker_supervisor.ex
index 4b5d10d2a20396c17f60c912e23cabdd571d1b24..5cb8d488a99fce63736d8aff1e2e493e2b849684 100644
(file)
--- a/
lib/pleroma/gun/connection_pool/worker_supervisor.ex
+++ b/
lib/pleroma/gun/connection_pool/worker_supervisor.ex
@@
-14,16
+14,14
@@
defmodule Pleroma.Gun.ConnectionPool.WorkerSupervisor do
)
end
)
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 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 ->
end
res ->