Skip to content

Commit

Permalink
Merge pull request #235 from draios/fix-token-bucket-rate
Browse files Browse the repository at this point in the history
Fix token bucket rate
  • Loading branch information
mstemm committed Apr 27, 2017
2 parents 76876bc + 1ad91c0 commit 060db62
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion userspace/engine/token_bucket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 060db62

Please sign in to comment.