mirror of
https://github.com/falcosecurity/falco.git
synced 2025-09-01 14:47:00 +00:00
Fix token bucket rate
We were dividing the tokens gained by the rate instead of multiplying.
This commit is contained in:
@@ -48,7 +48,7 @@ bool token_bucket::claim(uint64_t now)
|
|||||||
now = sinsp_utils::get_current_time_ns();
|
now = sinsp_utils::get_current_time_ns();
|
||||||
}
|
}
|
||||||
|
|
||||||
double tokens_gained = (now - m_last_seen) / (m_rate * 1000000000);
|
double tokens_gained = m_rate * ((now - m_last_seen) / (1000000000.0));
|
||||||
m_last_seen = now;
|
m_last_seen = now;
|
||||||
|
|
||||||
m_tokens += tokens_gained;
|
m_tokens += tokens_gained;
|
||||||
|
Reference in New Issue
Block a user