mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-21 03:25:34 +00:00
Bug修复+流量限制+带宽限制
This commit is contained in:
23
utils/rate_test.go
Normal file
23
utils/rate_test.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"log"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var rate = NewRate(100 * 1024)
|
||||
|
||||
func TestRate_Get(t *testing.T) {
|
||||
rate.Start()
|
||||
for i := 0; i < 5; i++ {
|
||||
go test(i)
|
||||
}
|
||||
test(5)
|
||||
}
|
||||
|
||||
func test(i int) {
|
||||
for {
|
||||
rate.Get(64 * 1024)
|
||||
log.Println("get ok", i)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user