x/time/rate: token bucket is not initially full #23482
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.9.2
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
Created a new limiter, and attempted to take a token at t=0:
What did you expect to see?
AllowN(...any time..., 1)
should succeed if the token bucket is initially full as documented.What did you see instead?
AllowN
returns falseIt appears that the token bucket is not initially full.
The limiter depends on the elapsed time from the zero value of
last
to the value ofnow
the first time AllowN is called being long enough to fill the bucket.The text was updated successfully, but these errors were encountered: