From f4e48bc53ee5ffeb9e7387219c0d46dc33d04521 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 23 Feb 2024 11:12:10 -0500 Subject: [PATCH] Rename variable to make the worker retry logic easier to read The boolean value matches the intent of the "last_attempt" variable name now --- changelog.d/gun_pool3.skip | 0 lib/pleroma/gun/connection_pool/worker_supervisor.ex | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 changelog.d/gun_pool3.skip diff --git a/changelog.d/gun_pool3.skip b/changelog.d/gun_pool3.skip new file mode 100644 index 000000000..e69de29bb diff --git a/lib/pleroma/gun/connection_pool/worker_supervisor.ex b/lib/pleroma/gun/connection_pool/worker_supervisor.ex index edaffcc25..eb83962d8 100644 --- a/lib/pleroma/gun/connection_pool/worker_supervisor.ex +++ b/lib/pleroma/gun/connection_pool/worker_supervisor.ex @@ -18,10 +18,10 @@ def init(_opts) do ) 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 {: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 :telemetry.execute([:pleroma, :connection_pool, :provision_failure], %{opts: opts})