Skip to content

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

fix(router): added validation check to number of workers in config (#3533)

Ravi Kiranc0e31ed1df6c
diff --git a/crates/router/src/configs/validations.rs b/crates/router/src/configs/validations.rs
index a4eb3f3c66..655dca3338 100644
--- a/crates/router/src/configs/validations.rs
+++ b/crates/router/src/configs/validations.rs
@@ -68,10 +68,18 @@ impl super::settings::Locker {
impl super::settings::Server {
pub fn validate(&self) -> Result<(), ApplicationError> {
- common_utils::fp_utils::when(self.host.is_default_or_empty(), || {
+ use common_utils::fp_utils::when;
+
+ when(self.host.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
"server host must not be empty".into(),
))
+ })?;
+
+ when(self.workers == 0, || {
+ Err(ApplicationError::InvalidConfigurationValueError(
+ "number of workers must be greater than 0".into(),
+ ))
})
}
}