diff --git a/src/service/rate_limiting/mod.rs b/src/service/rate_limiting/mod.rs index b33b2381..3900e843 100644 --- a/src/service/rate_limiting/mod.rs +++ b/src/service/rate_limiting/mod.rs @@ -89,8 +89,14 @@ impl Service { if *capacity >= limit.burst_capacity.get() { return Err(gap); } else { + let zero_capacity = *capacity == 0; *capacity += 1; - // TODO: update thing + + // Ensures that the update point is in the future + if zero_capacity { + *instant = Instant::now() + } + *instant += gap; } }