fix
This commit is contained in:
parent
743ea96157
commit
3be83ed424
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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{
|
||||
|
|
Loading…
Reference in New Issue
Block a user