Skip to content

Commit

Permalink
Merge pull request #29 from zhuCheer/master
Browse files Browse the repository at this point in the history
improved documentation and add the “Available” function explain.
  • Loading branch information
Rick Harding committed May 22, 2019
2 parents 59fac50 + acc0f5d commit 6070dec
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ rate tokens per second up to the given maximum capacity. Because of limited
clock resolution, at high rates, the actual rate may be up to 1% different from
the specified rate.

#### func (*Bucket) Available

```go
func (tb *Bucket) Available() int64
```
Available returns the number of available tokens. It will be negative
when there are consumers waiting for tokens. Note that if this
returns greater than zero, it does not guarantee that calls that take
tokens from the buffer will succeed, as the number of available
tokens could have changed in the meantime. This method is intended
primarily for metrics reporting and debugging.

#### func (*Bucket) Rate

```go
Expand Down

0 comments on commit 6070dec

Please sign in to comment.