添加 推送到渲染集群超时

This commit is contained in:
eson 2023-08-16 16:20:20 +08:00
parent 8358a4fd2e
commit 40b1163cc1
2 changed files with 9 additions and 10 deletions

View File

@ -36,7 +36,7 @@ var DequeueHandler = triggered.RegisterExecute(func(params *triggered.Params[boo
return return
} }
log.Println(item) // log.Println(item)
PopChannel <- item PopChannel <- item
} }
}) })

View File

@ -68,6 +68,14 @@ func queueHandler(w http.ResponseWriter, r *http.Request) {
} }
} }
err = conn.SetWriteDeadline(time.Now().Add(time.Second * 15))
if err != nil {
log.Println(err)
log.Println("重新回队")
stateClient.PushItem(nil, item)
return
}
// 写回消息 // 写回消息
err = conn.WriteMessage(websocket.BinaryMessage, wdata) err = conn.WriteMessage(websocket.BinaryMessage, wdata)
if err != nil { if err != nil {
@ -78,15 +86,6 @@ func queueHandler(w http.ResponseWriter, r *http.Request) {
} }
// 打印消息 // 打印消息
fmt.Printf("%s 处理完成. len\n", conn.RemoteAddr()) fmt.Printf("%s 处理完成. len\n", conn.RemoteAddr())
// 读取消息
// msgType, msg, err := conn.ReadMessage()
// if err != nil {
// log.Println(msgType, msg, err)
// return
// }
} }
} }