fix
This commit is contained in:
parent
743ea96157
commit
3be83ed424
|
@ -226,13 +226,13 @@ func (w *wsConnectItem) dealwithReciveData(data []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 把渲染好的数据放入outchan
|
// 把渲染好的数据放入outchan
|
||||||
func (w *wsConnectItem) setOutRenderImage(req types.RenderNotifyReq, ws wsConnectItem) {
|
func (w *wsConnectItem) setOutRenderImage(req types.RenderNotifyReq) {
|
||||||
ws.mutex.Lock()
|
w.mutex.Lock()
|
||||||
defer ws.mutex.Unlock()
|
defer w.mutex.Unlock()
|
||||||
for _, notifyItem := range req.NotifyList {
|
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 {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -244,13 +244,13 @@ func (w *wsConnectItem) setOutRenderImage(req types.RenderNotifyReq, ws wsConnec
|
||||||
}
|
}
|
||||||
b, _ := json.Marshal(responseData)
|
b, _ := json.Marshal(responseData)
|
||||||
select {
|
select {
|
||||||
case <-ws.closeChan:
|
case <-w.closeChan:
|
||||||
return
|
return
|
||||||
case ws.outChan <- b:
|
case w.outChan <- b:
|
||||||
logx.Info("notify send render result to out chan")
|
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 {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
ws.setOutRenderImage(req, ws)
|
ws.setOutRenderImage(req)
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
httpx.OkJsonCtx(r.Context(), w, basic.Response{
|
httpx.OkJsonCtx(r.Context(), w, basic.Response{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user