Browse Source

Request limiter setup: consider {:error, :existing} a success

When the application restarts (which happens after certain config
changes), the limiters are not destroyed, so `ConcurrentLimiter.new`
will produce {:error, :existing}
chores/our-libs-hex-releases
rinpatch 4 years ago
parent
commit
9b73c35ca8
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      lib/pleroma/http/adapter_helper/gun.ex

+ 7
- 1
lib/pleroma/http/adapter_helper/gun.ex View File

@@ -88,11 +88,17 @@ defmodule Pleroma.HTTP.AdapterHelper.Gun do
max_running = Keyword.get(opts, :size, 50)
max_waiting = Keyword.get(opts, :max_waiting, 10)

:ok =
result =
ConcurrentLimiter.new(:"#{@prefix}.#{name}", max_running, max_waiting,
wait: wait,
max_retries: retries
)

case result do
:ok -> :ok
{:error, :existing} -> :ok
e -> raise e
end
end)

:ok


Loading…
Cancel
Save