Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zjma committed Feb 28, 2024
1 parent 02cc8a8 commit 4f992f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
18 changes: 5 additions & 13 deletions consensus/src/rand/rand_gen/block_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::{
pipeline::buffer_manager::OrderedBlocks,
};
use aptos_consensus_types::{common::Round, pipelined_block::PipelinedBlock};
use aptos_logger::info;
use aptos_reliable_broadcast::DropGuard;
use aptos_types::randomness::{RandMetadata, Randomness};
use std::collections::{BTreeMap, HashMap};
Expand Down Expand Up @@ -86,26 +85,19 @@ impl QueueItem {

/// Maintain ordered blocks that have pending randomness
pub struct BlockQueue {
pub queue: BTreeMap<Round, QueueItem>,
queue: BTreeMap<Round, QueueItem>,
}
impl BlockQueue {
pub fn log_summary(&self) {
let min_round = self.queue.keys().min().copied();
let max_round = self.queue.keys().max().copied();
info!(
"block_queue_summary, size={}, min_round={:?}, max_round={:?}",
self.queue.len(),
min_round,
max_round
);
}

pub fn new() -> Self {
Self {
queue: BTreeMap::new(),
}
}

pub fn queue(&self) -> &BTreeMap<Round, QueueItem> {
&self.queue
}

pub fn push_back(&mut self, item: QueueItem) {
for block in item.blocks() {
observe_block(block.timestamp_usecs(), BlockStage::RAND_ENTER);
Expand Down
9 changes: 1 addition & 8 deletions consensus/src/rand/rand_gen/rand_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,7 @@ impl<S: TShare, D: TAugmentedData> RandManager<S, D> {
}

pub fn observe_queue(&self) {
let queue = &self.block_queue.queue;
let queue = &self.block_queue.queue();
RAND_QUEUE_SIZE.set(queue.len() as i64);
info!(
epoch = self.epoch_state.epoch,
queue_size = queue.len(),
min_round = queue.keys().min().copied(),
max_round = queue.keys().max().copied(),
"Rand queue summary.",
);
}
}

0 comments on commit 4f992f3

Please sign in to comment.