Skip to content

Commit

Permalink
Merge pull request #68 from shotover/perf-regression
Browse files Browse the repository at this point in the history
Fix perf issue
  • Loading branch information
benbromhead authored Nov 9, 2020
2 parents 7b38ad0 + 1569936 commit 43629d2
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/transforms/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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"),
Expand All @@ -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 {
Expand Down

0 comments on commit 43629d2

Please sign in to comment.