diff --git a/server/websocket/internal/logic/rendernotifylogic.go b/server/websocket/internal/logic/rendernotifylogic.go index 3ad4e9b2..58b9ffeb 100644 --- a/server/websocket/internal/logic/rendernotifylogic.go +++ b/server/websocket/internal/logic/rendernotifylogic.go @@ -6,6 +6,7 @@ import ( "fusenapi/utils/basic" "fusenapi/utils/file" "fusenapi/utils/websocket_data" + "time" "context" @@ -89,14 +90,20 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a RenderId: renderId, Image: uploadRes.ResourceUrl, }) - //删除对应的需要渲染的图片map - ws.renderProperty.renderImageTaskCtlChan <- renderImageControlChanItem{ + deleteTask := renderImageControlChanItem{ Option: 0, //0删除 1添加 TaskId: req.TaskId, RenderId: renderId, } - //发送数据到out chan - ws.sendToOutChan(b) + select { + case <-ws.closeChan: //关闭了 + return true + case ws.renderProperty.renderImageTaskCtlChan <- deleteTask: //删除对应的需要渲染的图片map + //发送数据到out chan + ws.sendToOutChan(b) + case <-time.After(time.Second * 3): //超时丢弃 + return true + } return true }) logx.Info("渲染回调成功######################")