Skip to content

Commit

Permalink
print cache avg el
Browse files Browse the repository at this point in the history
  • Loading branch information
RCasatta committed Oct 7, 2024
1 parent 6f45f00 commit 52a38c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/threads/update_mempool_info.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::collections::{BTreeSet, HashSet};
use std::collections::BTreeSet;
use std::sync::Arc;
use std::time::{Duration, Instant};

Expand Down
7 changes: 5 additions & 2 deletions src/threads/zmq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ async fn update_tx_zmq(socket: &SocketAddr, state: Arc<SharedState>) -> Result<(
}
}
if count % 10_000 == 0 {
let cache_len = state.txs.lock().await.len();
log::info!("zmq received {count} txs, cache len: {cache_len}");
let (cache_len, cache_avg) = {
let c = state.txs.lock().await;
(c.len(), c.avg())
};
log::info!("zmq received {count} txs, (cache len: {cache_len}, avg: {cache_avg:.1})");
}
}
Ok(())
Expand Down

0 comments on commit 52a38c6

Please sign in to comment.