fix
This commit is contained in:
parent
b7882ef06f
commit
62256cdde9
|
@ -195,6 +195,7 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
|
|||
renderImageTask: make(map[string]*renderTask),
|
||||
renderImageTaskCtlChan: make(chan renderImageControlChanItem, renderImageTaskCtlChanLen),
|
||||
renderChan: make(chan []byte, renderChanLen),
|
||||
renderConsumeTickTime: 1, //默认1纳秒,后面需要根据不同用户不同触发速度
|
||||
},
|
||||
}
|
||||
//保存连接
|
||||
|
|
|
@ -35,6 +35,7 @@ type extendRenderProperty struct {
|
|||
renderImageTask map[string]*renderTask //需要渲染的图片任务 key是taskId val 是renderId
|
||||
renderImageTaskCtlChan chan renderImageControlChanItem //渲染任务新增/回调结果移除任务/更新渲染耗时属性的控制通道(由于任务map无法读写并发)
|
||||
renderChan chan []byte //渲染消息入口的缓冲队列
|
||||
renderConsumeTickTime time.Duration //消费渲染消息时钟间隔(纳秒),用于后期控制不同类型用户渲染速度限制
|
||||
}
|
||||
|
||||
// 渲染任务新增移除的控制通道的数据
|
||||
|
@ -74,15 +75,15 @@ func (w *wsConnectItem) consumeRenderImageData() {
|
|||
logx.Error("func renderImage err:", err)
|
||||
}
|
||||
}()
|
||||
tick := time.Tick(w.extendRenderProperty.renderConsumeTickTime)
|
||||
for {
|
||||
select {
|
||||
case <-w.closeChan: //已关闭
|
||||
return
|
||||
case data := <-w.extendRenderProperty.renderChan:
|
||||
w.renderImage(data)
|
||||
case <-tick: //消费数据
|
||||
w.renderImage(<-w.extendRenderProperty.renderChan)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 执行渲染任务
|
||||
|
|
Loading…
Reference in New Issue
Block a user