This commit is contained in:
laodaming 2023-08-21 11:25:56 +08:00
parent 0990644b4a
commit feae3ada33

View File

@ -34,9 +34,9 @@ func (w *wsConnectItem) sendToRenderChan(data []byte) {
select {
case <-w.closeChan: //已经关闭
return
case w.renderProperty.renderChan <- data:
case w.renderProperty.renderChan <- data: //发入到缓冲池
return
case <-time.After(time.Second * 3):
case <-time.After(time.Second * 3): //三秒没进入缓冲池就丢弃
return
}
}
@ -296,15 +296,17 @@ func (w *wsConnectItem) assembleRenderData(taskId string, info websocket_data.Re
func (w *wsConnectItem) operationRenderTask() {
for {
select {
case <-w.closeChan:
case <-w.closeChan: //整个链接关闭
return
case data := <-w.renderProperty.renderImageTaskCtlChan:
case data := <-w.renderProperty.renderImageTaskCtlChan: //处理任务
switch data.Option {
case 0: //删除任务
delete(w.renderProperty.renderImageTask, data.TaskId)
case 1: //新增任务
w.renderProperty.renderImageTask[data.TaskId] = data.RenderId
}
case <-time.After(time.Second * 3): //三秒阻塞则丢弃
return
}
}
}