diff --git a/server/websocket/internal/handler/datatransferhandler.go b/server/websocket/internal/handler/datatransferhandler.go index 04f0a7ae..7c8a6c5b 100644 --- a/server/websocket/internal/handler/datatransferhandler.go +++ b/server/websocket/internal/handler/datatransferhandler.go @@ -226,13 +226,13 @@ func (w *wsConnectItem) dealwithReciveData(data []byte) { } // 把渲染好的数据放入outchan -func (w *wsConnectItem) setOutRenderImage(req types.RenderNotifyReq, ws wsConnectItem) { - ws.mutex.Lock() - defer ws.mutex.Unlock() +func (w *wsConnectItem) setOutRenderImage(req types.RenderNotifyReq) { + w.mutex.Lock() + defer w.mutex.Unlock() for _, notifyItem := range req.NotifyList { - renderKey := ws.getRenderImageMapKey(notifyItem.ProductId, notifyItem.SizeId, notifyItem.TemplateId) + renderKey := w.getRenderImageMapKey(notifyItem.ProductId, notifyItem.SizeId, notifyItem.TemplateId) //查询 - _, ok := ws.renderImage[renderKey] + _, ok := w.renderImage[renderKey] if !ok { continue } @@ -244,13 +244,13 @@ func (w *wsConnectItem) setOutRenderImage(req types.RenderNotifyReq, ws wsConnec } b, _ := json.Marshal(responseData) select { - case <-ws.closeChan: + case <-w.closeChan: return - case ws.outChan <- b: + case w.outChan <- b: logx.Info("notify send render result to out chan") } //删掉已经处理的渲染任务 - delete(ws.renderImage, renderKey) + delete(w.renderImage, renderKey) } } diff --git a/server/websocket/internal/handler/rendernotifyhandler.go b/server/websocket/internal/handler/rendernotifyhandler.go index b51fee32..005ee044 100644 --- a/server/websocket/internal/handler/rendernotifyhandler.go +++ b/server/websocket/internal/handler/rendernotifyhandler.go @@ -63,7 +63,7 @@ func RenderNotifyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { if !ok { return false } - ws.setOutRenderImage(req, ws) + ws.setOutRenderImage(req) return true }) httpx.OkJsonCtx(r.Context(), w, basic.Response{