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:
parent
1e76cc5cee
commit
499548321f
1 changed files with 7 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue