This commit is contained in:
laodaming 2023-09-21 17:06:12 +08:00
parent b230d764e0
commit f7c0d90ab3
2 changed files with 3 additions and 11 deletions

View File

@ -67,9 +67,9 @@ var (
//websocket连接存储
mapConnPool = sync.Map{}
//每个websocket连接入口缓冲队列长度默认值
websocketInChanLen = 500
websocketInChanLen = 50
//每个websocket连接出口缓冲队列长度默认值
websocketOutChanLen = 500
websocketOutChanLen = 50
//是否开启debug
openDebug = true
//允许跨域的origin
@ -400,9 +400,6 @@ func (w *wsConnectItem) sendToOutChan(data []byte) {
return
case w.outChan <- data:
return
case <-time.After(time.Millisecond * 50): //阻塞超过50ms丢弃
logx.Error("failed to send to out chan,time expired,data:", string(data))
return
}
}
@ -413,9 +410,6 @@ func (w *wsConnectItem) sendToInChan(data []byte) {
return
case w.inChan <- data:
return
case <-time.After(time.Millisecond * 200): //200豪秒超时丢弃说明超过消费速度了
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_INCOME_CACHE_QUEUE_OVERFLOW, "send message is too frequent,the message is ignore by system:"+string(data)))
return
}
}

View File

@ -21,7 +21,7 @@ import (
var (
//每个websocket渲染任务缓冲队列长度默认值
renderChanLen = 500
renderChanLen = 20
)
// 渲染处理器
@ -42,8 +42,6 @@ func (r *renderProcessor) allocationMessage(w *wsConnectItem, data []byte) {
return
case w.extendRenderProperty.renderChan <- data: //发入到缓冲队列
return
case <-time.After(time.Second * 3): //三秒没进入缓冲队列就丢弃
return
}
}