aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Strizhakov <alex.strizhakov@gmail.com>2020-03-03 18:01:35 +0300
committerAlexander Strizhakov <alex.strizhakov@gmail.com>2020-03-03 18:01:35 +0300
commit8854770fc4e9079131a0897d5fb6c0ccccf98bc6 (patch)
treed5b5db85277e265207d064d00a4df3a192692ee1
parent1ad34bfdbaee7d98167dc7dc7be8b65fd5e6c5f1 (diff)
downloadpleroma-8854770fc4e9079131a0897d5fb6c0ccccf98bc6.tar.gz
retry and retry_timeout settings default change
-rw-r--r--config/config.exs4
-rw-r--r--docs/configuration/cheatsheet.md4
-rw-r--r--lib/pleroma/gun/conn.ex4
-rw-r--r--lib/pleroma/http/adapter/gun.ex3
-rw-r--r--lib/pleroma/pool/connections.ex2
5 files changed, 9 insertions, 8 deletions
diff --git a/config/config.exs b/config/config.exs
index 661dfad20..f0dab24b5 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -609,8 +609,8 @@ config :pleroma, Pleroma.Repo,
config :pleroma, :connections_pool,
checkin_timeout: 250,
max_connections: 250,
- retry: 0,
- retry_timeout: 100,
+ retry: 1,
+ retry_timeout: 1000,
await_up_timeout: 5_000
config :pleroma, :pools,
diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md
index ef3cc40e6..a39a7436d 100644
--- a/docs/configuration/cheatsheet.md
+++ b/docs/configuration/cheatsheet.md
@@ -406,8 +406,8 @@ It will increase memory usage, but federation would work faster.
* `:checkin_timeout` - timeout to checkin connection from pool. Default: 250ms.
* `: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_timeout` - timeout while `gun` will try to reconnect. Default: 100ms.
+* `: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: 1000ms.
* `:await_up_timeout` - timeout while `gun` will wait until connection is up. Default: 5000ms.
### :pools
diff --git a/lib/pleroma/gun/conn.ex b/lib/pleroma/gun/conn.ex
index 9ae419092..d73bec360 100644
--- a/lib/pleroma/gun/conn.ex
+++ b/lib/pleroma/gun/conn.ex
@@ -42,8 +42,8 @@ defmodule Pleroma.Gun.Conn do
opts =
opts
|> Enum.into(%{})
- |> Map.put_new(:retry, pool_opts[:retry] || 0)
- |> Map.put_new(:retry_timeout, pool_opts[:retry_timeout] || 100)
+ |> Map.put_new(:retry, pool_opts[:retry] || 1)
+ |> Map.put_new(:retry_timeout, pool_opts[:retry_timeout] || 1000)
|> Map.put_new(:await_up_timeout, pool_opts[:await_up_timeout] || 5_000)
key = "#{uri.scheme}:#{uri.host}:#{uri.port}"
diff --git a/lib/pleroma/http/adapter/gun.ex b/lib/pleroma/http/adapter/gun.ex
index 30c5c3c16..ecf9c5b62 100644
--- a/lib/pleroma/http/adapter/gun.ex
+++ b/lib/pleroma/http/adapter/gun.ex
@@ -15,7 +15,8 @@ defmodule Pleroma.HTTP.Adapter.Gun do
connect_timeout: 5_000,
domain_lookup_timeout: 5_000,
tls_handshake_timeout: 5_000,
- retry: 0,
+ retry: 1,
+ retry_timeout: 1000,
await_up_timeout: 5_000
]
diff --git a/lib/pleroma/pool/connections.ex b/lib/pleroma/pool/connections.ex
index bde3ffd13..0f7a1bfd8 100644
--- a/lib/pleroma/pool/connections.ex
+++ b/lib/pleroma/pool/connections.ex
@@ -219,7 +219,7 @@ defmodule Pleroma.Pool.Connections do
@impl true
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
state =
with {key, conn} <- find_conn(state.conns, conn_pid),