diff --git a/src/rate_limit.c b/src/rate_limit.c index 2facdc1..a2ad6ef 100644 --- a/src/rate_limit.c +++ b/src/rate_limit.c @@ -32,9 +32,9 @@ static void uc_ratelimit_refill(struct RateLimit *r, long current_ts) //Find elapsed time diff_period = current_ts - r->last_refill_ts; - if (diff_period > r->period + 1) { - //help prevent overflow when calculating available_tickets below - diff_period = r->period + 1; + if (diff_period > r->period) { + //help prevent overflow when calculating available tickets below + diff_period = r->period; } else if (diff_period < 0) { //time went backwards, skip this round diff_period = 0;