mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-23 05:08:13 -05:00
Merge pull request #118 from Erope/pull
WebSocket增加Ping包 & Actions构建镜像时用户名转为小写 Co-authored-by: Erope <44471469+Erope@users.noreply.github.com>
This commit is contained in:
commit
31370292ab
6
.github/workflows/dashboard.yml
vendored
6
.github/workflows/dashboard.yml
vendored
@ -22,6 +22,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and push dasbboard image
|
- name: Build and push dasbboard image
|
||||||
run: |
|
run: |
|
||||||
|
go env
|
||||||
go test -v ./...
|
go test -v ./...
|
||||||
docker build -t ghcr.io/${{ github.repository_owner }}/nezha-dashboard -f Dockerfile .
|
IMAGE_NAME=$(echo "ghcr.io/${{ github.repository_owner }}/nezha-dashboard" | tr '[:upper:]' '[:lower:]')
|
||||||
docker push ghcr.io/${{ github.repository_owner }}/nezha-dashboard
|
docker build -t $IMAGE_NAME -f Dockerfile .
|
||||||
|
docker push $IMAGE_NAME
|
||||||
|
@ -185,6 +185,7 @@ func (cp *commonPage) ws(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
count := 0
|
||||||
for {
|
for {
|
||||||
dao.SortedServerLock.RLock()
|
dao.SortedServerLock.RLock()
|
||||||
err = conn.WriteJSON(dao.SortedServerList)
|
err = conn.WriteJSON(dao.SortedServerList)
|
||||||
@ -192,6 +193,13 @@ func (cp *commonPage) ws(c *gin.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
count += 1
|
||||||
|
if count%4 == 0 {
|
||||||
|
err = conn.WriteMessage(websocket.PingMessage, []byte{})
|
||||||
|
if err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
time.Sleep(time.Second * 2)
|
time.Sleep(time.Second * 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user