Skip to content

Commit

Permalink
[aptos channel] always reset counters on new channel (#12346)
Browse files Browse the repository at this point in the history
The consensus queues are recreated per epoch. Without resetting the counters, the metrics show as increasing number of "stuck" messages, which are simply messages that were in the queue during the epoch change (and hence were not dequeued or dropped).
  • Loading branch information
bchocho committed Apr 3, 2024
1 parent 137a82b commit cb915ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/channel/src/aptos_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ pub fn new<K: Eq + Hash + Clone, M>(
) -> (Sender<K, M>, Receiver<K, M>) {
let max_queue_size_per_key =
NonZeroUsize!(max_queue_size_per_key, "aptos_channel cannot be of size 0");
if let Some(counters) = counters {
counters.reset();
}
let shared_state = Arc::new(Mutex::new(SharedState {
internal_queue: PerKeyQueue::new(queue_style, max_queue_size_per_key, counters),
waker: None,
Expand Down

0 comments on commit cb915ef

Please sign in to comment.