fix
This commit is contained in:
parent
81e9ac861a
commit
ebb5846111
|
@ -25,5 +25,5 @@ const (
|
|||
//通用回调通知
|
||||
WEBSOCKET_COMMON_NOTIFY Websocket = "WEBSOCKET_COMMON_NOTIFY"
|
||||
//数据接收速度超过数据消费速度(缓冲队列满了)
|
||||
WEBSOCKET_REQUEST_CACHE_QUEUE_OVERFLOW = "WEBSOCKET_REQUEST_CACHE_QUEUE_OVERFLOW"
|
||||
WEBSOCKET_INCOME_CACHE_QUEUE_OVERFLOW = "WEBSOCKET_INCOME_CACHE_QUEUE_OVERFLOW"
|
||||
)
|
||||
|
|
|
@ -348,7 +348,8 @@ func (w *wsConnectItem) sendToOutChan(data []byte) {
|
|||
return
|
||||
case w.outChan <- data:
|
||||
return
|
||||
case <-time.After(time.Second * 3): //阻塞超过3秒丢弃
|
||||
case <-time.After(time.Millisecond * 200): //阻塞超过200ms丢弃
|
||||
logx.Error("failed to send to out chan,time expired,data:", string(data))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -361,7 +362,7 @@ func (w *wsConnectItem) sendToInChan(data []byte) {
|
|||
case w.inChan <- data:
|
||||
return
|
||||
case <-time.After(time.Millisecond * 200): //200豪秒超时丢弃,说明超过消费速度了
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_REQUEST_CACHE_QUEUE_OVERFLOW, "send message is too frequent,Please reduce the sending speed!!!"))
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_INCOME_CACHE_QUEUE_OVERFLOW, "send message is too frequent,Please reduce the sending speed ,otherwise, the message you sent may be lost"))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user