Skip to content

Commit

Permalink
Change to use recv() instead of try_recv() (#12)
Browse files Browse the repository at this point in the history
This changes the cpu usage from 100% to 0%.
  • Loading branch information
kitsuneninetails authored Jun 12, 2020
1 parent 11722e4 commit 8ac7ac9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ fn trace_server_loop(
loop {
let client = client.clone();

match buffer_receiver.try_recv() {
match buffer_receiver.recv() {
Ok(TraceCommand::Log(record)) => {
if let Some(ref lc) = log_config {
let skip = record
Expand Down Expand Up @@ -474,11 +474,10 @@ fn trace_server_loop(
trace!("CLOSE SPAN: {}/{}", trace_id, span_id);
storage.write().unwrap().end_span(trace_id, span_id);
}
Err(mpsc::TryRecvError::Disconnected) => {
Err(_) => {
warn!("Tracing channel disconnected, exiting");
return;
}
Err(_) => {}
}
}
}
Expand Down

0 comments on commit 8ac7ac9

Please sign in to comment.