Skip to content

Commit

Permalink
fix incorrect remainder calculation in RateLimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
taoky authored and djc committed Jul 27, 2023
1 parent 1cbfe20 commit 91ba34e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/draw_target.rs
Expand Up @@ -427,7 +427,7 @@ impl RateLimiter {
// convert into capacity now, so we're saving it for later.
let (new, remainder) = (
elapsed.as_millis() / self.interval as u128,
elapsed.as_nanos() % self.interval as u128 * 1_000_000,
elapsed.as_nanos() % (self.interval as u128 * 1_000_000),
);

// We add `new` to `capacity`, subtract one for returning `true` from here,
Expand Down

0 comments on commit 91ba34e

Please sign in to comment.