Skip to content

Commit a84bc0b

Browse files
intel352claude
andcommitted
fix: min builtin type mismatch in rate limiter (float64 vs int)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7aa1635 commit a84bc0b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

module/http_middleware.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@ func (m *RateLimitMiddleware) Process(next http.Handler) http.Handler {
162162
elapsed := time.Since(c.lastTimestamp).Minutes()
163163
tokensToAdd := elapsed * m.ratePerMinute
164164
if tokensToAdd > 0 {
165-
c.tokens = min(c.tokens+tokensToAdd, float64(m.burstSize))
165+
if newTokens := c.tokens + tokensToAdd; newTokens < float64(m.burstSize) {
166+
c.tokens = newTokens
167+
} else {
168+
c.tokens = float64(m.burstSize)
169+
}
166170
c.lastTimestamp = time.Now()
167171
}
168172
}

0 commit comments

Comments
 (0)