remove proactive health check

This commit is contained in:
liuzhihang1
2025-02-16 00:27:16 +08:00
parent 9bc0a15c0d
commit 96174f200d
2 changed files with 0 additions and 28 deletions

View File

@@ -28,7 +28,6 @@ type configuration struct {
KillWaitTime int `default:"5" describe:"kill信号等待时间"`
TaskTimeout int `default:"60" describe:"任务执行超时时间(秒)"`
TokenExpirationTime int64 `default:"720" describe:"token过期时间小时"`
WsProactiveHealthCheck bool `default:"false" describe:"ws主动健康检查"`
CgroupPeriod int64 `default:"100000" describe:"CgroupPeriod"`
CgroupSwapLimit bool `default:"false" describe:"cgroup swap限制"`
CondWaitTime int `default:"30" describe:"长轮询等待时间(秒)"`

View File

@@ -100,31 +100,4 @@ func (w *wsApi) startWsConnect(conn *websocket.Conn, cancel context.CancelFunc,
}
}
}()
if config.CF.WsProactiveHealthCheck {
w.proactiveHealthCheck(conn, cancel)
}
}
func (w *wsApi) proactiveHealthCheck(conn *websocket.Conn, cancel context.CancelFunc) {
pongChan := make(chan struct{})
conn.SetPongHandler(func(appData string) error {
pongChan <- struct{}{}
return nil
})
timer := time.NewTimer(time.Second)
go func() {
defer timer.Stop()
for {
conn.WriteMessage(websocket.PingMessage, nil)
select {
case <-pongChan:
timer.Reset(time.Second)
case <-timer.C:
log.Logger.Debugw("pong报文超时,结束ws连接")
cancel()
return
}
time.Sleep(time.Second * 3)
}
}()
}