diff --git a/config/config.exs b/config/config.exs index a78a3e108..b1c318369 100644 --- a/config/config.exs +++ b/config/config.exs @@ -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 diff --git a/config/description.exs b/config/description.exs index 7fa087024..48d6a1ef4 100644 --- a/config/description.exs +++ b/config/description.exs @@ -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, diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index ae84a8b7d..febdca71e 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -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. diff --git a/lib/pleroma/pool/connections.ex b/lib/pleroma/pool/connections.ex index 28d37760e..49b68fc26 100644 --- a/lib/pleroma/pool/connections.ex +++ b/lib/pleroma/pool/connections.ex @@ -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