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(api_locking): add delay between api-locking retries (#9308)
Hrithikesh4052f8a28c55
diff --git a/crates/router/src/core/api_locking.rs b/crates/router/src/core/api_locking.rsindex 60fc9ae0a3..dd3712e380 100644--- a/crates/router/src/core/api_locking.rs+++ b/crates/router/src/core/api_locking.rs@@ -79,6 +79,10 @@ impl LockAction {.map(|input| input.get_redis_locking_key(&merchant_id)).map(|key| (RedisKey::from(key.as_str()), request_id.clone())).collect::<Vec<_>>();+ let delay_between_retries_in_milliseconds = state+ .conf()+ .lock_settings+ .delay_between_retries_in_milliseconds;for _retry in 0..lock_retries {let results: Vec<redis::SetGetReply<_>> = redis_conn.set_multiple_keys_if_not_exists_and_get_values(@@ -95,6 +99,11 @@ impl LockAction {if lock_aqcuired {logger::info!("Lock acquired for locking inputs {:?}", inputs);return Ok(());+ } else {+ actix_time::sleep(tokio::time::Duration::from_millis(u64::from(+ delay_between_retries_in_milliseconds,+ )))+ .await;}}Err(report!(errors::ApiErrorResponse::ResourceBusy))