Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(request): add `idle_pool_connection_timeout` as a config (#2016)
Nishant Joshi6247996ddead
diff --git a/config/config.example.toml b/config/config.example.tomlindex 00db69da0f..222e131607 100644--- a/config/config.example.toml+++ b/config/config.example.toml@@ -16,6 +16,8 @@ request_body_limit = 32_768[proxy]# http_url = "http proxy url" # Proxy all HTTP traffic via this proxy# https_url = "https proxy url" # Proxy all HTTPS traffic via this proxy+idle_pool_connection_timeout = 90 # Timeout for idle pool connections (defaults to 90s)+# Main SQL data store credentials[master_database]@@ -396,4 +398,4 @@ adyen.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamaladyen.banks = "bangkok_bank,krungsri_bank,krung_thai_bank,the_siam_commercial_bank,kasikorn_bank"[multiple_api_version_supported_connectors]-supported_connectors = ["braintree"]\ No newline at end of file+supported_connectors = ["braintree"]diff --git a/config/development.toml b/config/development.tomlindex 69447e462f..112caeec1c 100644--- a/config/development.toml+++ b/config/development.toml@@ -402,4 +402,4 @@ merchant_ids_send_payment_id_as_connector_request_id = []payout_eligibility = true[multiple_api_version_supported_connectors]-supported_connectors = "braintree"\ No newline at end of file+supported_connectors = "braintree"diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rsindex 2c116ebd76..554d7f6fb6 100644--- a/crates/router/src/configs/defaults.rs+++ b/crates/router/src/configs/defaults.rs@@ -33,6 +33,16 @@ impl Default for super::settings::Database {}}+impl Default for super::settings::Proxy {+ fn default() -> Self {+ Self {+ http_url: Default::default(),+ https_url: Default::default(),+ idle_pool_connection_timeout: Some(90),+ }+ }+}+impl Default for super::settings::Locker {fn default() -> Self {Self {diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rsindex cd1c42cb87..45bbacfc3c 100644--- a/crates/router/src/configs/settings.rs+++ b/crates/router/src/configs/settings.rs@@ -409,11 +409,12 @@ pub struct Jwekey {pub tunnel_private_key: String,}-#[derive(Debug, Deserialize, Clone, Default)]+#[derive(Debug, Deserialize, Clone)]#[serde(default)]pub struct Proxy {pub http_url: Option<String>,pub https_url: Option<String>,+ pub idle_pool_connection_timeout: Option<u64>,}#[derive(Debug, Deserialize, Clone)]diff --git a/crates/router/src/services/api/client.rs b/crates/router/src/services/api/client.rsindex b65487cc61..1b3b5fc19d 100644--- a/crates/router/src/services/api/client.rs+++ b/crates/router/src/services/api/client.rs@@ -22,7 +22,13 @@ fn get_client_builder(proxy_config: &Proxy,should_bypass_proxy: bool,) -> CustomResult<reqwest::ClientBuilder, ApiClientError> {- let mut client_builder = reqwest::Client::builder().redirect(reqwest::redirect::Policy::none());+ let mut client_builder = reqwest::Client::builder()+ .redirect(reqwest::redirect::Policy::none())+ .pool_idle_timeout(std::time::Duration::from_secs(+ proxy_config+ .idle_pool_connection_timeout+ .unwrap_or_default(),+ ));if should_bypass_proxy {return Ok(client_builder);