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:
parent
eb13ef5a21
commit
f23f5adcf2
1 changed files with 2 additions and 2 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue