解决并发情况下,TraceID可能互相覆盖问题

This commit is contained in:
2021-04-18 20:11:48 +08:00
parent 0ddab40835
commit 47e35b35bd
2 changed files with 25 additions and 2 deletions

View File

@ -160,7 +160,7 @@ func initServer(wsInstance abstract.IWebsocket) {
// TODO : 增加指令回调失败的callback
ctxInterface, _ := session.Get("ws_context")
ctx := ctxInterface.(*context.WSContext)
_ = dispatchCommand(ctx, bytes)
_ = dispatchCommand(context.CloneContext(ctx), bytes)
})
// 3, 关闭连接的处理函数
wsServerTable[wsInstance.GetServerPort()][wsInstance.GetModuleFlag()].wsServer.HandleClose(func(session *melody.Session, i int, s string) error {