Fix token bucket rate

We were dividing the tokens gained by the rate instead of multiplying.
This commit is contained in:
Mark Stemm 2017-04-26 19:02:04 -07:00
parent 76876bc3ae
commit 1ad91c05f5

View File

@ -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;