mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 00:26:30 +00:00
Rename variable to make the worker retry logic easier to read
The boolean value matches the intent of the "last_attempt" variable name now
This commit is contained in:
parent
72fc41d891
commit
f4e48bc53e
2 changed files with 2 additions and 2 deletions
0
changelog.d/gun_pool3.skip
Normal file
0
changelog.d/gun_pool3.skip
Normal file
|
@ -18,10 +18,10 @@ defmodule Pleroma.Gun.ConnectionPool.WorkerSupervisor 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 a new issue