mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-31 14:20:04 +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();
|
||||
}
|
||||
|
||||
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_tokens += tokens_gained;
|
||||
|
Reference in New Issue
Block a user