diff --git a/server/websocket/internal/logic/ws_render_image_logic.go b/server/websocket/internal/logic/ws_render_image_logic.go index 3d4f42c5..7e44e43d 100644 --- a/server/websocket/internal/logic/ws_render_image_logic.go +++ b/server/websocket/internal/logic/ws_render_image_logic.go @@ -34,9 +34,9 @@ func (w *wsConnectItem) sendToRenderChan(data []byte) { select { case <-w.closeChan: //已经关闭 return - case w.renderProperty.renderChan <- data: + case w.renderProperty.renderChan <- data: //发入到缓冲池 return - case <-time.After(time.Second * 3): + case <-time.After(time.Second * 3): //三秒没进入缓冲池就丢弃 return } } @@ -296,15 +296,17 @@ func (w *wsConnectItem) assembleRenderData(taskId string, info websocket_data.Re func (w *wsConnectItem) operationRenderTask() { for { select { - case <-w.closeChan: + case <-w.closeChan: //整个链接关闭 return - case data := <-w.renderProperty.renderImageTaskCtlChan: + case data := <-w.renderProperty.renderImageTaskCtlChan: //处理任务 switch data.Option { case 0: //删除任务 delete(w.renderProperty.renderImageTask, data.TaskId) case 1: //新增任务 w.renderProperty.renderImageTask[data.TaskId] = data.RenderId } + case <-time.After(time.Second * 3): //三秒阻塞则丢弃 + return } } }