From f23f5adcf22a8a1381f74af8c857d8e01effb24e Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 10:25:33 +0100 Subject: [PATCH] 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 --- pkg/mining/ratelimiter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/mining/ratelimiter.go b/pkg/mining/ratelimiter.go index b56ee7a..dd17d39 100644 --- a/pkg/mining/ratelimiter.go +++ b/pkg/mining/ratelimiter.go @@ -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()