feat(config): config option to timeout idle connections within the reqwest pool (#551)

This commit is contained in:
Kekma 2024-03-30 18:35:44 +05:30 committed by GitHub
parent bb50e8bb25
commit b1df4f1154
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 0 deletions

View file

@ -78,6 +78,9 @@ pub async fn aggregate(
let client = CLIENT.get_or_init(|| {
ClientBuilder::new()
.timeout(Duration::from_secs(config.request_timeout as u64)) // Add timeout to request to avoid DDOSing the server
.pool_idle_timeout(Duration::from_secs(
config.pool_idle_connection_timeout as u64,
))
.tcp_keepalive(Duration::from_secs(config.tcp_connection_keepalive as u64))
.connect_timeout(Duration::from_secs(config.request_timeout as u64)) // Add timeout to request to avoid DDOSing the server
.https_only(true)