pub fn update(&mut self, queue_length: usize, consumed: usize) {
        if consumed > 0 {
            // Only update the average if either:
            // a. Not drained below the current average
            // b. Drained the queue, but the queue was not bigger than the
            //    current running average

            let remainder = queue_length.saturating_sub(consumed);

            if remainder > self.avg.value() || consumed > self.avg.value() {
                self.avg.update(consumed);
            }
        }
    }
/// Use the current queue size and the number of items consumed to
/// update the queue limit, if there was a significant enough change.
/// Args:
///     queue_length (int): the current size of the queue
///     consumed (int): the number items consumed
Use the current queue size and the number of items consumed to
update the queue limit, if there was a significant enough change.
Args:
queue_length (int): the current size of the queue
consumed (int): the number items consumed
Use the current queue size and the number of items consumed to update the queue limit if there was a significant enough change . Args : queue_length ( int ) : the current size of the queue consumed ( int ) : the number items consumed
pub fn update(&mut self, queue_length: usize, consumed: usize) {
        if consumed > 0 {
            // Only update the average if either:
            // a. Not drained below the current average
            // b. Drained the queue, but the queue was not bigger than the
            //    current running average
            let remainder = queue_length.saturating_sub(consumed);
            if remainder > self.avg.value() || consumed > self.avg.value() {
                self.avg.update(consumed);
            }
        }
    }
pub fn update ( & mut self , queue_length : usize , consumed : usize ) { if consumed > 0 { // Only update the average if either: // a. Not drained below the current average // b. Drained the queue, but the queue was not bigger than the //    current running average let remainder = queue_length . saturating_sub ( consumed ) ; if remainder > self . avg . value ( ) || consumed > self . avg . value ( ) { self . avg . update ( consumed ) ; } } }
Use the current queue size and the number of items consumed to
update the queue limit, if there was a significant enough change.
Use the current queue size and the number of items consumed to update the queue limit if there was a significant enough change .
&mut self
queue_length
usize
consumed
usize
&mut self
queue_length
usize
consumed
usize