sethvargo/go-limiter

Out of date comment?

carlpett opened this issue · 2 comments

Hey,
Thanks for publishing this! Currently reading through the code, and snagged on this comment:

// Add it to the map. Since this is the first time, they can't possibly be
// rate limited yet, so return true.
s.data[key] = b
s.dataLock.Unlock()
return b.take()

While b.take() will return true, the comment is a bit confusing. I suspect it was written before that call was put in, I guess to avoid having an extra parameter to newBucket with "initial tokens"?

Oh yea, that's outdated. The original implementation didn't include "buckets".

This issue has been automatically locked since there has not been any
recent activity after it was closed. Please open a new issue for
related bugs.