Skip to content

Commit

Permalink
fix: 修复 server 异步消息的 callback 的并发问题
Browse files Browse the repository at this point in the history
将 callback 转为系统消息的方式执行
kercylan98 committed Jul 29, 2023
1 parent abd1db5 commit 1297ae7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
@@ -569,7 +569,9 @@ func (slf *Server) dispatchMessage(msg *Message) {
}()
err := handle()
if cb && callback != nil {
callback(err)
PushSystemMessage(slf, func() {
callback(err)
}, "AsyncCallback")
} else {
log.Error("Server", log.String("MessageType", messageNames[msg.t]), log.Any("error", err), log.String("stack", string(debug.Stack())))
}

0 comments on commit 1297ae7

Please sign in to comment.