From f7c0d90ab3e6332d5a5e30e0eab1d8cfc0621b7b Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 21 Sep 2023 17:06:12 +0800 Subject: [PATCH] fix --- server/websocket/internal/logic/datatransferlogic.go | 10 ++-------- server/websocket/internal/logic/ws_render_image.go | 4 +--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index ca5d3bb9..974e3bf6 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -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 } } diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index f1ac5270..41f6e070 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -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 } }