Skip to content

Commit 7ebe750

Browse files
authored
Merge pull request #19 from ready-to-review/cleanup
more code cleanup
2 parents 3c812c2 + 15d0a31 commit 7ebe750

File tree

3 files changed

+4
-98
lines changed

3 files changed

+4
-98
lines changed

.DS_Store

-8 KB
Binary file not shown.

.claude/CLAUDE.md

Lines changed: 0 additions & 89 deletions
This file was deleted.

cmd/goose/ratelimit.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ func (r *RateLimiter) Allow() bool {
3636
tokensToAdd := int(elapsed / r.refillRate)
3737

3838
if tokensToAdd > 0 {
39-
r.tokens = minInt(r.tokens+tokensToAdd, r.maxTokens)
39+
r.tokens += tokensToAdd
40+
if r.tokens > r.maxTokens {
41+
r.tokens = r.maxTokens
42+
}
4043
r.lastRefill = now
4144
}
4245

@@ -48,11 +51,3 @@ func (r *RateLimiter) Allow() bool {
4851

4952
return false
5053
}
51-
52-
// minInt returns the minimum of two integers.
53-
func minInt(a, b int) int {
54-
if a < b {
55-
return a
56-
}
57-
return b
58-
}

0 commit comments

Comments
 (0)