other: 修改 server.Server 慢消息检测的异步消息判定条件为 1 秒
This commit is contained in:
parent
47b8a333eb
commit
8917326a24
|
@ -479,9 +479,9 @@ func (slf *Server) pushMessage(message *Message) {
|
|||
slf.messageChannel <- message
|
||||
}
|
||||
|
||||
func (slf *Server) low(message *Message, present time.Time) {
|
||||
func (slf *Server) low(message *Message, present time.Time, expect time.Duration) {
|
||||
cost := time.Since(present)
|
||||
if cost > time.Millisecond*100 {
|
||||
if cost > expect {
|
||||
log.Warn("Server", zap.String("LowExecCost", cost.String()), zap.Any("Message", message))
|
||||
slf.OnMessageLowExecEvent(message, cost)
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ func (slf *Server) dispatchMessage(msg *Message) {
|
|||
|
||||
if msg.t != MessageTypeAsync {
|
||||
super.Handle(cancel)
|
||||
slf.low(msg, present)
|
||||
slf.low(msg, present, time.Millisecond*100)
|
||||
if !slf.isShutdown.Load() {
|
||||
slf.messagePool.Release(msg)
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ func (slf *Server) dispatchMessage(msg *Message) {
|
|||
}
|
||||
}
|
||||
super.Handle(cancel)
|
||||
slf.low(msg, present)
|
||||
slf.low(msg, present, time.Second)
|
||||
if !slf.isShutdown.Load() {
|
||||
slf.messagePool.Release(msg)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue