ax(mining): replace prose comments with usage examples in ratelimiter

AX Principle 2: comments show HOW with real values, not prose descriptions.
cleanupLoop and cleanup had restatement comments; converted to call-site examples
matching the pattern used throughout the file.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 10:25:33 +01:00
parent eb13ef5a21
commit f23f5adcf2
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -39,7 +39,7 @@ func NewRateLimiter(requestsPerSecond, burst int) *RateLimiter {
return rl
}
// cleanupLoop removes stale clients periodically
// go rl.cleanupLoop() // started by NewRateLimiter; runs until rl.Stop()
func (rl *RateLimiter) cleanupLoop() {
ticker := time.NewTicker(time.Minute)
defer ticker.Stop()
@ -54,7 +54,7 @@ func (rl *RateLimiter) cleanupLoop() {
}
}
// cleanup removes clients that haven't made requests in 5 minutes
// rl.cleanup() // called every minute by cleanupLoop; evicts IPs idle for >5 minutes
func (rl *RateLimiter) cleanup() {
rl.mu.Lock()
defer rl.mu.Unlock()