retry and retry_timeout settings default change

This commit is contained in:
Alexander Strizhakov 2020-03-03 18:01:35 +03:00
parent 1ad34bfdba
commit 8854770fc4
No known key found for this signature in database
GPG key ID: 022896A53AEF1381
5 changed files with 9 additions and 8 deletions
config
docs/configuration
lib/pleroma
gun
http/adapter
pool

View file

@ -609,8 +609,8 @@
config :pleroma, :connections_pool, config :pleroma, :connections_pool,
checkin_timeout: 250, checkin_timeout: 250,
max_connections: 250, max_connections: 250,
retry: 0, retry: 1,
retry_timeout: 100, retry_timeout: 1000,
await_up_timeout: 5_000 await_up_timeout: 5_000
config :pleroma, :pools, config :pleroma, :pools,

View file

@ -406,8 +406,8 @@ It will increase memory usage, but federation would work faster.
* `:checkin_timeout` - timeout to checkin connection from pool. Default: 250ms. * `:checkin_timeout` - timeout to checkin connection from pool. Default: 250ms.
* `:max_connections` - maximum number of connections in the pool. Default: 250 connections. * `:max_connections` - maximum number of connections in the pool. Default: 250 connections.
* `:retry` - number of retries, while `gun` will try to reconnect if connections goes down. Default: 5. * `:retry` - number of retries, while `gun` will try to reconnect if connections goes down. Default: 1.
* `:retry_timeout` - timeout while `gun` will try to reconnect. Default: 100ms. * `:retry_timeout` - timeout while `gun` will try to reconnect. Default: 1000ms.
* `:await_up_timeout` - timeout while `gun` will wait until connection is up. Default: 5000ms. * `:await_up_timeout` - timeout while `gun` will wait until connection is up. Default: 5000ms.
### :pools ### :pools

View file

@ -42,8 +42,8 @@ def open(%URI{} = uri, name, opts) do
opts = opts =
opts opts
|> Enum.into(%{}) |> Enum.into(%{})
|> Map.put_new(:retry, pool_opts[:retry] || 0) |> Map.put_new(:retry, pool_opts[:retry] || 1)
|> Map.put_new(:retry_timeout, pool_opts[:retry_timeout] || 100) |> Map.put_new(:retry_timeout, pool_opts[:retry_timeout] || 1000)
|> Map.put_new(:await_up_timeout, pool_opts[:await_up_timeout] || 5_000) |> Map.put_new(:await_up_timeout, pool_opts[:await_up_timeout] || 5_000)
key = "#{uri.scheme}:#{uri.host}:#{uri.port}" key = "#{uri.scheme}:#{uri.host}:#{uri.port}"

View file

@ -15,7 +15,8 @@ defmodule Pleroma.HTTP.Adapter.Gun do
connect_timeout: 5_000, connect_timeout: 5_000,
domain_lookup_timeout: 5_000, domain_lookup_timeout: 5_000,
tls_handshake_timeout: 5_000, tls_handshake_timeout: 5_000,
retry: 0, retry: 1,
retry_timeout: 1000,
await_up_timeout: 5_000 await_up_timeout: 5_000
] ]

View file

@ -219,7 +219,7 @@ def handle_info({:gun_up, conn_pid, _protocol}, state) do
@impl true @impl true
def handle_info({:gun_down, conn_pid, _protocol, _reason, _killed}, state) do def handle_info({:gun_down, conn_pid, _protocol, _reason, _killed}, state) do
retries = Config.get([:connections_pool, :retry], 0) retries = Config.get([:connections_pool, :retry], 1)
# we can't get info on this pid, because pid is dead # we can't get info on this pid, because pid is dead
state = state =
with {key, conn} <- find_conn(state.conns, conn_pid), with {key, conn} <- find_conn(state.conns, conn_pid),