fix: 上行分发前统一限速,send 不再单独扣桶
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user