mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2026-02-06 08:05:51 +08:00
提升节点组合配置效率
This commit is contained in:
@@ -3,7 +3,9 @@ package models
|
||||
import (
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"github.com/iwind/TeaGo/dbs"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestNodeDAO_FindAllNodeIdsMatch(t *testing.T) {
|
||||
@@ -34,3 +36,23 @@ func TestNodeDAO_FindEnabledNodeClusterIds(t *testing.T) {
|
||||
}
|
||||
t.Log(clusterIds)
|
||||
}
|
||||
|
||||
func TestNodeDAO_ComposeNodeConfig(t *testing.T) {
|
||||
dbs.NotifyReady()
|
||||
|
||||
before := time.Now()
|
||||
defer func() {
|
||||
t.Log(time.Since(before).Seconds()*1000, "ms")
|
||||
}()
|
||||
|
||||
var tx *dbs.Tx
|
||||
var cacheMap = maps.Map{}
|
||||
nodeConfig, err := SharedNodeDAO.ComposeNodeConfig(tx, 48, cacheMap)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(len(nodeConfig.Servers), "servers")
|
||||
t.Log(len(cacheMap), "items")
|
||||
|
||||
// old: 77ms => new: 56ms
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user