(new): expand runtime APIs
Golang lint / lint (push) Successful in 58s
Golang lint / lint (pull_request) Successful in 13m10s

(fix): harden concurrent lifecycle
(tests): add regression coverage
(doc): update v1.2 guidance
This commit is contained in:
2026-08-20 11:08:45 +03:00
parent 29b208eeec
commit 24040fe164
37 changed files with 1129 additions and 157 deletions
+15
View File
@@ -189,3 +189,18 @@ func TestRateLimiterCleanupEvictsIdleChats(t *testing.T) {
t.Fatal("expected future chat 11 lock to remain")
}
}
func TestRateLimiterCleanupPreservesAcquiredLimiter(t *testing.T) {
rl := NewRateLimiter()
limiter, release := rl.acquireChatLimiter(42)
rl.chatMu.Lock()
rl.chatLastSeen[42] = time.Now().Add(-time.Hour)
rl.chatMu.Unlock()
rl.Cleanup(time.Minute)
if got := rl.getChatLimiter(42); got != limiter {
t.Fatal("Cleanup replaced a limiter while it was acquired")
}
release()
}