Merge pull request #161 from AkkiaS7/master

optimise: 优化websocket数据包发送逻辑 加快首次访问时监控信息载入速度

Co-authored-by: AkkiaS7 <68485070+AkkiaS7@users.noreply.github.com>
This commit is contained in:
naiba 2022-04-16 19:54:54 +08:00 committed by GitHub
commit 0a7044f78c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -182,12 +182,7 @@ func (cp *commonPage) ws(c *gin.Context) {
if err != nil {
continue
}
writer, err := conn.NextWriter(websocket.TextMessage)
if err != nil {
break
}
_, err = writer.Write(stat)
if err != nil {
if err := conn.WriteMessage(websocket.TextMessage, stat); err != nil {
break
}
count += 1