perf(server): 调整服务器心跳间隔并优化服务器信息列表
- 将服务器心跳间隔从 3 秒调整为 10 秒 - 在 CommendSvrInfo 中使用 array 包对服务器信息列表进行排序 - 更新 go.mod 和 go.sum 文件,添加新的依赖项
This commit is contained in:
@@ -4,6 +4,9 @@ import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/base/service"
|
||||
"blazing/modules/blazing/model"
|
||||
"fmt"
|
||||
|
||||
"github.com/butoften/array"
|
||||
)
|
||||
|
||||
// CommendSvrInfo 初始连接请求信息结构体
|
||||
@@ -80,7 +83,10 @@ func GetServerInfoList() []ServerInfo {
|
||||
ret1 = append(ret1, *tt)
|
||||
|
||||
}
|
||||
|
||||
array.Sort(&ret1, func(a ServerInfo, b ServerInfo) bool {
|
||||
return a.OnlineID < b.OnlineID
|
||||
})
|
||||
fmt.Printf("升序 Sort: %v\n", ret1)
|
||||
return ret1
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user