fix
This commit is contained in:
parent
53e20dfd63
commit
e813ec5575
|
@ -37,7 +37,6 @@ type extendRenderProperty struct {
|
|||
renderCtx context.Context //渲染控制上下文(用于切换模板标签/颜色/logo取消之前发送的不相同的任务)
|
||||
renderCtxCancelFunc context.CancelFunc //渲染控制上下文取消方法
|
||||
selectColorIndex int //选择的颜色索引(用于标记连接当前连接选择的颜色)
|
||||
templateTag string //模板标签 (用于标记连接当前连接选择的模板标签)
|
||||
Logo string //logo地址 (用于标记连接当前连接选择的logo)
|
||||
}
|
||||
|
||||
|
@ -52,9 +51,6 @@ func (r *renderProcessor) allocationMessage(w *wsConnectItem, data []byte) {
|
|||
}
|
||||
//颜色/模板标签/logo变更
|
||||
ifCancelOldCtx := false
|
||||
if renderImageData.RenderData.TemplateTag != w.extendRenderProperty.templateTag {
|
||||
ifCancelOldCtx = true
|
||||
}
|
||||
if renderImageData.RenderData.TemplateTagColor.SelectedColorIndex != w.extendRenderProperty.selectColorIndex {
|
||||
ifCancelOldCtx = true
|
||||
}
|
||||
|
@ -63,7 +59,6 @@ func (r *renderProcessor) allocationMessage(w *wsConnectItem, data []byte) {
|
|||
}
|
||||
if ifCancelOldCtx {
|
||||
//赋值新的
|
||||
w.extendRenderProperty.templateTag = renderImageData.RenderData.TemplateTag
|
||||
w.extendRenderProperty.selectColorIndex = renderImageData.RenderData.TemplateTagColor.SelectedColorIndex
|
||||
w.extendRenderProperty.Logo = renderImageData.RenderData.Logo
|
||||
//让之前的失效
|
||||
|
@ -115,23 +110,20 @@ func (w *wsConnectItem) consumeRenderImageData() {
|
|||
defer func() {
|
||||
<-limitChan
|
||||
}()
|
||||
//如果不是无视上下文切换取消的(后面再开启)
|
||||
/*if !d.IgnoreContextCancel {
|
||||
go func() {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
logx.Error("func renderImage panic:", err)
|
||||
}
|
||||
}()
|
||||
select {
|
||||
case <-w.extendRenderProperty.renderCtx.Done():
|
||||
//抛出取消渲染异常
|
||||
cancelRenderPanic()
|
||||
case <-tmpChan:
|
||||
return
|
||||
go func() {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
logx.Error("func renderImage panic:", err)
|
||||
}
|
||||
}()
|
||||
}*/
|
||||
select {
|
||||
case <-w.extendRenderProperty.renderCtx.Done():
|
||||
//抛出取消渲染异常
|
||||
cancelRenderPanic()
|
||||
case <-tmpChan:
|
||||
return
|
||||
}
|
||||
}()
|
||||
w.renderImage(d)
|
||||
}(data)
|
||||
}
|
||||
|
|
|
@ -2,9 +2,8 @@ package websocket_data
|
|||
|
||||
// websocket接受要云渲染处理的数据
|
||||
type RenderImageReqMsg struct {
|
||||
RequestId string `json:"request_id"`
|
||||
IgnoreContextCancel bool `json:"ignore_context_cancel"` //是否无视切换上下文取消正在执行的渲染任务
|
||||
RenderData RenderData `json:"render_data"` //渲染主要参数
|
||||
RequestId string `json:"request_id"`
|
||||
RenderData RenderData `json:"render_data"` //渲染主要参数
|
||||
}
|
||||
type RenderData struct {
|
||||
TemplateTag string `json:"template_tag"` //模板标签(必须)
|
||||
|
|
Loading…
Reference in New Issue
Block a user