fix
This commit is contained in:
parent
b868ef19ae
commit
417126484b
|
@ -48,11 +48,11 @@ func (r *renderProcessor) allocationMessage(w *wsConnectItem, data []byte) {
|
|||
logx.Error("invalid format of websocket render image message", err)
|
||||
return
|
||||
}
|
||||
//颜色/模板标签/logo变更
|
||||
ifCancelOldCtx := false
|
||||
/*if renderImageData.RenderData.TemplateTag != w.extendRenderProperty.templateTag {
|
||||
//颜色/模板标签/logo变更(后面再开启)
|
||||
/*ifCancelOldCtx := false
|
||||
if renderImageData.RenderData.TemplateTag != w.extendRenderProperty.templateTag {
|
||||
ifCancelOldCtx = true
|
||||
}*/
|
||||
}
|
||||
if renderImageData.RenderData.TemplateTagColor.SelectedColorIndex != w.extendRenderProperty.selectColorIndex {
|
||||
ifCancelOldCtx = true
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ func (r *renderProcessor) allocationMessage(w *wsConnectItem, data []byte) {
|
|||
w.extendRenderProperty.renderCtxCancelFunc()
|
||||
//重新赋值
|
||||
w.extendRenderProperty.renderCtx, w.extendRenderProperty.renderCtxCancelFunc = context.WithCancel(w.logic.ctx)
|
||||
}
|
||||
}*/
|
||||
select {
|
||||
case <-w.closeChan: //已经关闭
|
||||
return
|
||||
|
@ -95,20 +95,6 @@ func (w *wsConnectItem) consumeRenderImageData() {
|
|||
case <-w.closeChan: //已关闭
|
||||
return
|
||||
case data := <-w.extendRenderProperty.renderChan: //消费数据
|
||||
//标签不一样
|
||||
/*if data.RenderData.TemplateTag != w.extendRenderProperty.templateTag {
|
||||
//logx.Info("标签不一致,丢弃消息")
|
||||
continue
|
||||
}*/
|
||||
//颜色不一致
|
||||
if data.RenderData.TemplateTagColor.SelectedColorIndex != w.extendRenderProperty.selectColorIndex {
|
||||
//logx.Info("颜色不一致,丢弃消息")
|
||||
continue
|
||||
}
|
||||
//logo不一样
|
||||
if data.RenderData.Logo != w.extendRenderProperty.Logo {
|
||||
continue
|
||||
}
|
||||
limitChan <- struct{}{}
|
||||
go func(d websocket_data.RenderImageReqMsg) {
|
||||
defer func() {
|
||||
|
@ -122,6 +108,8 @@ func (w *wsConnectItem) consumeRenderImageData() {
|
|||
defer func() {
|
||||
<-limitChan
|
||||
}()
|
||||
//如果不是无视上下文切换取消的(后面再开启)
|
||||
/*if !d.IgnoreContextCancel {
|
||||
go func() {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
|
@ -135,6 +123,7 @@ func (w *wsConnectItem) consumeRenderImageData() {
|
|||
return
|
||||
}
|
||||
}()
|
||||
}*/
|
||||
w.renderImage(d)
|
||||
}(data)
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package websocket_data
|
|||
// websocket接受要云渲染处理的数据
|
||||
type RenderImageReqMsg struct {
|
||||
RequestId string `json:"request_id"`
|
||||
IgnoreContextCancel bool `json:"ignore_context_cancel"` //是否无视切换上下文取消正在执行的渲染任务
|
||||
RenderData RenderData `json:"render_data"` //渲染主要参数
|
||||
}
|
||||
type RenderData struct {
|
||||
|
|
Loading…
Reference in New Issue
Block a user