File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -154,19 +154,21 @@ limiter, err := rate.NewTokenBucketLimiter(
154154The token bucket algorithm uses a simple metaphor of a bucket that holds tokens:
155155
156156```
157- ┌─────────────────────────┐
158- │ │
159- │ ┌───┐ ┌───┐ ┌───┐ │
160- │ │ T │ │ T │ │ T │ │ ← Tokens in bucket (current: 3)
161- │ └───┘ └───┘ └───┘ │
162- │ │ ← Empty space (burst capacity: 10)
163- │ │
164- └─────────────────────────┘
157+ ┌─────────────────────────────────────┐
158+ │ │
159+ │ ┌───┐ ┌───┐ ┌───┐ ┌ ┐ ┌ ┐ │
160+ │ │ T │ │ T │ │ T │ │ │ │ │ │
161+ │ └───┘ └───┘ └───┘ └ ┘ └ ┘ │
162+ │ ↑ ↑ ↑ │
163+ │ avail avail avail │
164+ │ │
165+ │ Available: 3 tokens │ Capacity: 5 │
166+ └─────────────────────────────────────┘
165167 │
166168 │ Refill rate: 100 tokens/second
167169 ▼
168170 ┌───┐ ┌───┐
169- │ T │ │ T │ ... ← New tokens added at constant rate
171+ │ T │ │ T │ ... ← New tokens added at constant rate
170172 └───┘ └───┘
171173```
172174
You can’t perform that action at this time.
0 commit comments