Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions broadcast/src/buffered/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,10 @@ impl<E: Clock + Spawner + Metrics, P: PublicKey, M: Committable + Digestible + C
let dropped_count = initial_len - waiters.len();

// Increment metrics for each dropped waiter
for _ in 0..dropped_count {
self.metrics.get.inc(Status::Dropped);
if dropped_count > 0 {
self.metrics
.subscribe
.inc_by(Status::Dropped, dropped_count as u64);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Metric count truncation on wide platforms

dropped_count is a usize but gets cast with dropped_count as u64 for subscribe.inc_by. On platforms where usize is wider than 64 bits (or with extremely large waiter lists), this cast truncates and silently undercounts dropped waiters in metrics.

Fix in Cursor Fix in Web


!waiters.is_empty()
Expand Down
2 changes: 1 addition & 1 deletion broadcast/src/buffered/ingress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use futures::{
SinkExt,
};

/// Message types that can be sent to the `Mailbox`
/// Message types that can be sent to the [`Mailbox`]
pub enum Message<P: PublicKey, M: Committable + Digestible> {
/// Broadcast a [crate::Broadcaster::Message] to the network.
///
Expand Down