Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
loewenheim committed Jul 23, 2024
1 parent 346d3a6 commit b6e0d02
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
5 changes: 4 additions & 1 deletion relay-config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,10 @@ impl Config {
pub fn redis(&self) -> Option<RedisPoolConfigs> {
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.
Expand Down
11 changes: 4 additions & 7 deletions relay-config/src/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(),
Expand All @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions relay-server/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@ impl ServiceState {
}

fn create_redis_pool(
(connection, options): (&RedisConnection,
RedisConfigOptions),
(connection, options): (&RedisConnection, RedisConfigOptions),
) -> Result<RedisPool, RedisError> {
match connection {
RedisConnection::Cluster(servers) => {
Expand Down
3 changes: 2 additions & 1 deletion relay-server/src/services/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit b6e0d02

Please sign in to comment.