May be I am missing something crucial here, but is there something wrong
with this line:
r.allowance += float64(elapsed) * rate
Unit of `elapsed` is `time.Duration` (which is the same as
`time.Nanosecond`), while rate is per sec (as the comment above the
definition of NewRateLimiter function). When the 2 multiply, it will be
huge. Although it's clamped below, it seems like it's unlimited. I think
the correct one should be:
r.allowance += float64(elapsed) / float64(time.Second) * rate
The code is from Github Wiki and I don't know where to report or even if I
am right, so I have to ask here first. Apologize to readers for any
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/d/optout.