-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: track buffered outgoing messages #12220
feat: track buffered outgoing messages #12220
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits
pub fn push_back(&mut self, message: OutgoingMessage) { | ||
self.messages.push_back(message); | ||
self.count.increment(1); | ||
} | ||
|
||
pub fn pop_front(&mut self) -> Option<OutgoingMessage> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can also make this pub crate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
let message = self.messages.pop_front(); | ||
if message.is_some() { | ||
self.count.decrement(1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can solve this with Option::inspect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pub(crate) struct QueuedOutgoingMessages { | ||
messages: VecDeque<OutgoingMessage>, | ||
count: Gauge, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could use a one line doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
pub(crate) struct QueuedOutgoingMessages { | ||
messages: VecDeque<OutgoingMessage>, | ||
count: Gauge, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at the ordering in Gaugefn impl for Atomic I believe this should work and not result in overflows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Closes #12203