From b6e0d02f5458e343b315b639c93dff45aaa795df Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Tue, 23 Jul 2024 16:23:08 +0200 Subject: [PATCH] Fix types --- relay-config/src/config.rs | 5 ++++- relay-config/src/redis.rs | 11 ++++------- relay-server/src/service.rs | 3 +-- relay-server/src/services/processor.rs | 3 ++- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/relay-config/src/config.rs b/relay-config/src/config.rs index 17cf96062f..292d318399 100644 --- a/relay-config/src/config.rs +++ b/relay-config/src/config.rs @@ -2283,7 +2283,10 @@ impl Config { pub fn redis(&self) -> Option { let redis_configs = self.values.processing.redis.as_ref()?; - Some(create_redis_pools(redis_configs, self.cpu_concurrency())) + Some(create_redis_pools( + redis_configs, + self.cpu_concurrency() as u32, + )) } /// Chunk size of attachments in bytes. diff --git a/relay-config/src/redis.rs b/relay-config/src/redis.rs index 3145fad697..b5cc0ef9d2 100644 --- a/relay-config/src/redis.rs +++ b/relay-config/src/redis.rs @@ -164,7 +164,7 @@ pub struct RedisPoolConfigs<'a> { pub(super) fn create_redis_pool( config: &RedisConfig, - default_connections: usize, + default_connections: u32, ) -> (&RedisConnection, RedisConfigOptions) { let options = RedisConfigOptions { max_connections: config @@ -181,14 +181,11 @@ pub(super) fn create_redis_pool( (&config.connection, options) } -pub(super) fn create_redis_pools( - configs: &RedisConfigs, - cpu_concurrency: usize, -) -> RedisPoolConfigs { +pub(super) fn create_redis_pools(configs: &RedisConfigs, cpu_concurrency: u32) -> RedisPoolConfigs { match configs { RedisConfigs::Unified(cfg) => { let default_connections = - (cpu_concurrency * 2).min(crate::redis::DEFAULT_MIN_MAX_CONNECTIONS as usize); + (cpu_concurrency * 2).min(crate::redis::DEFAULT_MIN_MAX_CONNECTIONS); let pool = create_redis_pool(cfg, default_connections); RedisPoolConfigs { project_configs: pool.clone(), @@ -205,7 +202,7 @@ pub(super) fn create_redis_pools( } => { let project_configs = create_redis_pool( project_configs, - (cpu_concurrency * 2).min(crate::redis::DEFAULT_MIN_MAX_CONNECTIONS as usize), + (cpu_concurrency * 2).min(crate::redis::DEFAULT_MIN_MAX_CONNECTIONS), ); let cardinality = create_redis_pool(cardinality, cpu_concurrency); let quotas = create_redis_pool(quotas, cpu_concurrency); diff --git a/relay-server/src/service.rs b/relay-server/src/service.rs index e20536a841..4b45fcdf67 100644 --- a/relay-server/src/service.rs +++ b/relay-server/src/service.rs @@ -363,8 +363,7 @@ impl ServiceState { } fn create_redis_pool( - (connection, options): (&RedisConnection, - RedisConfigOptions), + (connection, options): (&RedisConnection, RedisConfigOptions), ) -> Result { match connection { RedisConnection::Cluster(servers) => { diff --git a/relay-server/src/services/processor.rs b/relay-server/src/services/processor.rs index 2430d4d0f3..5a63f07ec9 100644 --- a/relay-server/src/services/processor.rs +++ b/relay-server/src/services/processor.rs @@ -1169,7 +1169,8 @@ impl EnvelopeProcessorService { #[cfg(feature = "processing")] quotas_pool: quotas.clone(), #[cfg(feature = "processing")] - rate_limiter: quotas.map(|quotas| RedisRateLimiter::new(quotas).max_limit(config.max_rate_limit())), + rate_limiter: quotas + .map(|quotas| RedisRateLimiter::new(quotas).max_limit(config.max_rate_limit())), addrs, geoip_lookup, #[cfg(feature = "processing")]