Made a stylistic change to the new message throttling code.

This commit is contained in:
Aaron Weiss 2018-01-01 21:52:23 -05:00
parent 70ff2ec992
commit 68666aef09
No known key found for this signature in database
GPG key ID: 047D32DF25DC22EF

View file

@ -152,12 +152,9 @@ where
Err(error::ErrorKind::PingTimeout.into()) Err(error::ErrorKind::PingTimeout.into())
} else { } else {
// Check if the oldest message in the rolling window is discounted. // Check if the oldest message in the rolling window is discounted.
match self.rolling_burst_window_front()? { if let Async::Ready(()) = self.rolling_burst_window_front()? {
Async::NotReady => (), self.current_burst_messages -= 1;
Async::Ready(()) => { self.rolling_burst_window.pop_front();
self.current_burst_messages -= 1;
self.rolling_burst_window.pop_front();
}
} }
// Throttling if too many messages have been sent recently. // Throttling if too many messages have been sent recently.