From c0e31ed1df6cd1f17727c9ebf9d308ede02f2228 Mon Sep 17 00:00:00 2001 From: Ravi Kiran <80111421+ravikiran232@users.noreply.github.com> Date: Wed, 7 Feb 2024 14:49:20 +0530 Subject: [PATCH] fix(router): added validation check to number of workers in config (#3533) --- crates/router/src/configs/validations.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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(), + )) }) } }