mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-12-17 13:46:02 +08:00
修复字典选项和公告提示加载异常,优化tcp和websocket消息处理
This commit is contained in:
@@ -10,13 +10,9 @@ import (
|
||||
"encoding/json"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/net/gtcp"
|
||||
"github.com/gogf/gf/v2/os/grpool"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
// GoPool 初始化一个协程池,用于处理消息处理
|
||||
var GoPool = grpool.New(20)
|
||||
|
||||
// RouterHandler 路由消息处理器
|
||||
type RouterHandler func(ctx context.Context, args ...interface{})
|
||||
|
||||
@@ -64,11 +60,3 @@ func MsgPkg(data interface{}, auth *AuthMeta, traceID string) string {
|
||||
}
|
||||
return msg.TraceID
|
||||
}
|
||||
|
||||
// doHandleRouterMsg 处理路由消息
|
||||
func doHandleRouterMsg(fun RouterHandler, ctx context.Context, cancel context.CancelFunc, args ...interface{}) {
|
||||
_ = GoPool.Add(ctx, func(ctx context.Context) {
|
||||
fun(ctx, args...)
|
||||
cancel()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user