Skip to content

Commit

Permalink
Remove extra cell when comparing additional weight and tau
Browse files Browse the repository at this point in the history
Since 273f77b, both relate to the cells *in addition* to the first
cell.

Fixes: 273f77b ("Differentiate between GCRA burst capacity and tolerance")
  • Loading branch information
jonasmalacofilho committed Dec 9, 2024
1 parent 246ea18 commit fe0a3dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions governor/src/gcra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ impl Gcra {
let t = self.t;
let additional_weight = t * (n.get() - 1) as u64;

// check that we can allow enough cells through. Note that `additional_weight` is the
// value of the cells *in addition* to the first cell - so add that first cell back.
if additional_weight + t > tau {
// Check that we can allow enough cells through. Note that both `additional_weight` and
// `tau` represent the value of the cells *in addition* to the first cell.
if additional_weight > tau {
return Err(InsufficientCapacity(
1 + (self.tau.as_u64() / t.as_u64()) as u32,
));
Expand Down

0 comments on commit fe0a3dc

Please sign in to comment.