aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Strizhakov <alex.strizhakov@gmail.com>2020-03-03 13:05:28 +0300
committerAlexander Strizhakov <alex.strizhakov@gmail.com>2020-03-03 13:05:28 +0300
commit28ed4b41d03c6a137d198b8c67fb081c7ebfbbc6 (patch)
tree8b8769b9a5a00dfe133c156a8048385de3126f10
parent151dc4e387cfbb91b7cd85461ce0deb1e5f5fe30 (diff)
downloadpleroma-28ed4b41d03c6a137d198b8c67fb081c7ebfbbc6.tar.gz
naming for checkin from pool timeout
-rw-r--r--config/config.exs2
-rw-r--r--docs/configuration/cheatsheet.md2
-rw-r--r--lib/pleroma/pool/connections.ex3
-rw-r--r--test/pool/connections_test.exs3
4 files changed, 5 insertions, 5 deletions
diff --git a/config/config.exs b/config/config.exs
index 7c94a0f26..661dfad20 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -607,7 +607,7 @@ config :pleroma, Pleroma.Repo,
prepare: :unnamed
config :pleroma, :connections_pool,
- receive_connection_timeout: 250,
+ checkin_timeout: 250,
max_connections: 250,
retry: 0,
retry_timeout: 100,
diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md
index 65f37e846..ef3cc40e6 100644
--- a/docs/configuration/cheatsheet.md
+++ b/docs/configuration/cheatsheet.md
@@ -404,7 +404,7 @@ Advanced settings for connections pool. Pool with opened connections. These conn
For big instances it's recommended to increase `config :pleroma, :connections_pool, max_connections: 500` up to 500-1000.
It will increase memory usage, but federation would work faster.
-* `:receive_connection_timeout` - timeout to receive 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.
* `: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.
diff --git a/lib/pleroma/pool/connections.ex b/lib/pleroma/pool/connections.ex
index 84617815f..05fa8f7ad 100644
--- a/lib/pleroma/pool/connections.ex
+++ b/lib/pleroma/pool/connections.ex
@@ -34,7 +34,7 @@ defmodule Pleroma.Pool.Connections do
def checkin(url, name) when is_binary(url), do: checkin(URI.parse(url), name)
def checkin(%URI{} = uri, name) do
- timeout = Config.get([:connections_pool, :receive_connection_timeout], 250)
+ timeout = Config.get([:connections_pool, :checkin_timeout], 250)
GenServer.call(
name,
@@ -184,6 +184,7 @@ defmodule Pleroma.Pool.Connections do
time = :os.system_time(:second)
last_reference = time - conn.last_reference
current_crf = crf(last_reference, 100, conn.crf)
+
put_in(state.conns[key], %{
conn
| gun_state: :up,
diff --git a/test/pool/connections_test.exs b/test/pool/connections_test.exs
index 0e7a118ab..a084f31b9 100644
--- a/test/pool/connections_test.exs
+++ b/test/pool/connections_test.exs
@@ -24,8 +24,7 @@ defmodule Pleroma.Pool.ConnectionsTest do
adapter = Application.get_env(:tesla, :adapter)
Application.put_env(:tesla, :adapter, Tesla.Adapter.Gun)
- {:ok, pid} =
- Connections.start_link({name, [max_connections: 2, receive_connection_timeout: 1_500]})
+ {:ok, pid} = Connections.start_link({name, [max_connections: 2, checkin_timeout: 1_500]})
on_exit(fn ->
Application.put_env(:tesla, :adapter, adapter)