diff --git a/src/sinks/redis/run.rs b/src/sinks/redis/run.rs index 800322e2..782fbc70 100644 --- a/src/sinks/redis/run.rs +++ b/src/sinks/redis/run.rs @@ -36,15 +36,11 @@ pub fn producer_loop( for event in input.iter() { utils.track_sink_progress(&event); let payload = RedisRecord::from(event); - let stream: String; - match stream_strategy { - StreamStrategy::ByEventType => { - stream = payload.event.data.clone().to_string().to_lowercase(); - } - _ => { - stream = redis_stream.clone(); - } - } + + let stream = match stream_strategy { + StreamStrategy::ByEventType => payload.event.data.clone().to_string().to_lowercase(), + _ => redis_stream.clone(), + }; log::debug!( "Stream: {:?}, Key: {:?}, Event: {:?}", diff --git a/src/sinks/redis/setup.rs b/src/sinks/redis/setup.rs index 22290d44..671c85dd 100644 --- a/src/sinks/redis/setup.rs +++ b/src/sinks/redis/setup.rs @@ -32,7 +32,12 @@ impl SinkProvider for WithUtils { _ => StreamStrategy::None, }; - let redis_stream = self.inner.stream_name.clone().unwrap_or("oura".to_string()); + let redis_stream = self + .inner + .stream_name + .clone() + .unwrap_or_else(|| "oura".to_string()); + let utils = self.utils.clone(); let handle = std::thread::spawn(move || { producer_loop(input, utils, &mut connection, stream_strategy, redis_stream)