description:"Advanced settings for `Gun` connections pool",
children:[
%{
key::connection_acquisition_wait,
type::integer,
description:
"Timeout to acquire a connection from pool. The total max time is this value multiplied by the number of retries. Default: 250ms.",
suggestions:[250]
},
%{
key::connection_acquisition_retries,
type::integer,
description:
"Number of attempts to acquire the connection from the pool if it is overloaded. Default: 5",
suggestions:[5]
},
%{
key::max_connections,
type::integer,
description:"Maximum number of connections in the pool. Default: 250 connections.",
suggestions:[250]
},
%{
key::connect_timeout,
type::integer,
description:"Timeout while `gun` will wait until connection is up. Default: 5000ms.",
suggestions:[5000]
},
%{
key::reclaim_multiplier,
type::integer,
description:
"Multiplier for the number of idle connection to be reclaimed if the pool is full. For example if the pool maxes out at 250 connections and this setting is set to 0.3, the pool will reclaim at most 75 idle connections if it's overloaded. Default: 0.1",
suggestions:[0.1]
}
]
},
%{
group::pleroma,
key::pools,
type::group,
description:"Advanced settings for `Gun` workers pools",
description:"Maximum number of concurrent requests in the pool.",
suggestions:[50]
},
%{
key::max_waiting,
type::integer,
description:
"Maximum number of requests waiting for other requests to finish. After this number is reached, the pool will start returning errrors when a new request is made",
suggestions:[10]
},
%{
key::recv_timeout,
type::integer,
description:"Timeout for the pool while gun will wait for response",
suggestions:[10_000]
}
]
}
end)
},
%{
group::pleroma,
key::hackney_pools,
type::group,
description:"Advanced settings for `Hackney` connections pools",
children:[
%{
key::federation,
type::keyword,
description:"Settings for federation pool.",
children:[
%{
key::max_connections,
type::integer,
description:"Number workers in the pool.",
suggestions:[50]
},
%{
key::timeout,
type::integer,
description:"Timeout while `hackney` will wait for response.",
suggestions:[150_000]
}
]
},
%{
key::media,
type::keyword,
description:"Settings for media pool.",
children:[
%{
key::max_connections,
type::integer,
description:"Number workers in the pool.",
suggestions:[50]
},
%{
key::timeout,
type::integer,
description:"Timeout while `hackney` will wait for response.",
suggestions:[150_000]
}
]
},
%{
key::upload,
type::keyword,
description:"Settings for upload pool.",
children:[
%{
key::max_connections,
type::integer,
description:"Number workers in the pool.",
suggestions:[25]
},
%{
key::timeout,
type::integer,
description:"Timeout while `hackney` will wait for response.",
@ -59,34 +59,8 @@ defmodule Pleroma.Application do
Pleroma.Docs.JSON.compile()
limiters_setup()
adapter=Application.get_env(:tesla,:adapter)
ifmatch?({Tesla.Adapter.Finch,_},adapter)do
Logger.info("Starting Finch")
Finch.start_link(name:MyFinch)
end
ifadapter==Tesla.Adapter.Gundo
ifversion=Pleroma.OTPVersion.version()do
[major,minor]=
version
|>String.split(".")
|>Enum.map(&String.to_integer/1)
|>Enum.take(2)
if(major==22andminor<2)ormajor<22do
raise"
!!!OTPVERSIONWARNING!!!
YouareusinggunadapterwithOTPversion#{version}, which doesn't support correct handling of unordered certificates chains. Please update your Erlang/OTP to at least 22.2.
"Connection pool is exhausted (reached #{max_connections} connections). Starting idle connection cleanup to reclaim as much as #{reclaim_max} connections"
"Connection pool failed to reclaim any connections due to all of them being in use. It will have to drop requests for opening connections to new hosts"
end)
iflogging_config[:enabled]&&
logging_config[:min_duration]&&
query_time>logging_config[:min_duration]and
(is_nil(logging_config[:exclude_sources])or
source notinlogging_config[:exclude_sources])do
log_slow_query(measurements,metadata,config)
else
:ok
end
end
defhandle_event(
[:pleroma,:connection_pool,:reclaim,:stop],
%{reclaimed_count:reclaimed_count},
_,
_
)do
Logger.debug(fn->"Connection pool cleaned up #{reclaimed_count} idle connections"end)