mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-17 21:57:17 +00:00
Merge pull request #235 from draios/fix-token-bucket-rate
Fix token bucket rate
This commit is contained in:
commit
060db62644
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user