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

fix nano gap

This commit is contained in:
Matthias Ahouansou 2024-06-26 16:26:30 +01:00
parent 024f910bf9
commit e20fcb029a
No known key found for this signature in database

View file

@ -78,7 +78,7 @@ impl Service {
tracing::info!(?limit); tracing::info!(?limit);
let increment = 1_000_000_000u64 / limit.timeframe.nano_gap() * limit.weight.get(); let increment = limit.timeframe.nano_gap() * limit.weight.get();
tracing::info!(?increment); tracing::info!(?increment);
let mut prev_expectation = self let mut prev_expectation = self
@ -87,7 +87,7 @@ impl Service {
.as_deref() .as_deref()
.map(|n| n.load(Ordering::Acquire)) .map(|n| n.load(Ordering::Acquire))
.unwrap_or_else(|| arrival + increment); .unwrap_or_else(|| arrival + increment);
let weight = (increment * limit.burst_capacity.get()).max(1); let weight = increment * limit.burst_capacity.get();
tracing::info!(?prev_expectation); tracing::info!(?prev_expectation);
tracing::info!(?weight); tracing::info!(?weight);