changing default connection idle time before close

This commit is contained in:
Alexander Strizhakov 2020-04-29 16:29:24 +03:00
parent 73b1b3ff5e
commit d645b7114e
No known key found for this signature in database
GPG Key ID: 022896A53AEF1381
4 changed files with 10 additions and 10 deletions

View File

@ -608,8 +608,8 @@ config :pleroma, Pleroma.Repo,
config :pleroma, :connections_pool,
checkin_timeout: 250,
max_connections: 250,
max_idle_time: 5,
closing_idle_conns_interval: 5,
max_idle_time: 1,
closing_idle_conns_interval: 1,
retry: 1,
retry_timeout: 1000,
await_up_timeout: 5_000

View File

@ -2945,15 +2945,15 @@ config :pleroma, :config_description, [
key: :max_idle_time,
type: :integer,
description:
"Maximum of time in minutes, while connection can be idle. Default: 5 minutes.",
suggestions: [5]
"Maximum of time in minutes, while connection can be idle. Default: 1 minute.",
suggestions: [1]
},
%{
key: :closing_idle_conns_interval,
type: :integer,
description:
"Interval between cleaning pool in minutes from idle connections. Default: 5 minutes.",
suggestions: [5]
"Interval between cleaning pool in minutes from idle connections. Default: 1 minute.",
suggestions: [1]
},
%{
key: :retry,

View File

@ -398,8 +398,8 @@ For big instances it's recommended to increase `max_connections` up to 500-1000.
* `:checkin_timeout` - timeout to checkin connection from pool. Default: 250ms.
* `:max_connections` - maximum number of connections in the pool. Default: 250 connections.
* `:max_idle_time` - maximum of time in minutes, while connection can be idle. Default: 5 minutes.
* `:closing_idle_conns_interval` - interval between cleaning pool in minutes from idle connections. Default: 5 minutes.
* `:max_idle_time` - maximum of time in minutes, while connection can be idle. Default: 1 minute.
* `:closing_idle_conns_interval` - interval between cleaning pool in minutes from idle connections. Default: 1 minute.
* `:retry` - number of retries, while `gun` will try to reconnect if connection goes down. Default: 1.
* `:retry_timeout` - time between retries when `gun` will try to reconnect in milliseconds. Default: 1000ms.
* `:await_up_timeout` - timeout while `gun` will wait until connection is up. Default: 5000ms.

View File

@ -339,8 +339,8 @@ defmodule Pleroma.Pool.Connections do
end
defp schedule_close_idle_conns do
max_idle_time = Config.get([:connections_pool, :max_idle_time], 10) * 60
interval = Config.get([:connections_pool, :closing_idle_conns_interval], 10) * 60 * 1000
max_idle_time = Config.get([:connections_pool, :max_idle_time], 1) * 60
interval = Config.get([:connections_pool, :closing_idle_conns_interval], 1) * 60 * 1000
Process.send_after(self(), {:close_idle_conns, max_idle_time}, interval)
end