1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-06-27 16:35:59 +00:00

enforce maximum capacity

This commit is contained in:
Matthias Ahouansou 2024-07-10 11:17:38 +01:00
parent 1e76cc5cee
commit 499548321f
No known key found for this signature in database

View file

@ -89,8 +89,14 @@ impl Service {
if *capacity >= limit.burst_capacity.get() { if *capacity >= limit.burst_capacity.get() {
return Err(gap); return Err(gap);
} else { } else {
let zero_capacity = *capacity == 0;
*capacity += 1; *capacity += 1;
// TODO: update thing
// Ensures that the update point is in the future
if zero_capacity {
*instant = Instant::now()
}
*instant += gap; *instant += gap;
} }
} }