fix: 上行分发前统一限速,send 不再单独扣桶

This commit is contained in:
Nixevol
2026-09-30 16:21:05 +08:00
parent f139b9ed9b
commit aa24e974af
7 changed files with 155 additions and 13 deletions
+22
View File
@@ -0,0 +1,22 @@
package message
import (
"testing"
)
func TestAllowRequestBurstAndAckExemptBucket(t *testing.T) {
t.Parallel()
lim := defaultTestLimits()
lim.RequestsPerSecond = 50
lim.RequestBurst = 100
app, _ := openTestApp(t, lim)
allowed := 0
for i := 0; i < 150; i++ {
if app.AllowRequest("alice") {
allowed++
}
}
if allowed != 100 {
t.Fatalf("allowed=%d want 100 (burst)", allowed)
}
}