From 156993602f5942e74f8c8b37e44789ca61d50516 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 9 Nov 2020 15:50:58 +1300 Subject: [PATCH] Fix perf issue remove a bunch of copying etc --- src/transforms/chain.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/transforms/chain.rs b/src/transforms/chain.rs index d39dab104..9b6701fe9 100644 --- a/src/transforms/chain.rs +++ b/src/transforms/chain.rs @@ -92,15 +92,12 @@ impl TransformChain { // Even though we don't keep the join handle, this thread will wrap up once all corresponding senders have been dropped. let _jh = tokio::spawn(async move { let mut chain = self; - let mut last_message = None; - let mut last_response = None; while let Some(ChannelMessage { return_chan, messages, }) = rx.recv().await { - last_message = Some(messages.clone()); let name = chain.name.clone(); if cfg!(test) { let mut count = count.lock().await; @@ -121,14 +118,9 @@ impl TransformChain { match future.fuse().await { Ok(chain_response) => { - match &chain_response { - Ok(m) => { - last_response = Some(m.clone()); - } - Err(e) => { - warn!("Internal error in buffered chain: {:?} - resetting", e); - chain = chain.clone(); - } + if let Err(e) = &chain_response { + warn!("Internal error in buffered chain: {:?} - resetting", e); + chain = chain.clone(); }; match return_chan { None => trace!("Ignoring response due to lack of return chan"), @@ -149,7 +141,7 @@ impl TransformChain { } } } - warn!("buffered chain processing thread exiting, stopping chain loop and dropping - last message {:?} - last response - {:?}", last_message, last_response); + trace!("buffered chain processing thread exiting, stopping chain loop and dropping"); }); BufferedChain {