diff --git a/config/config.go b/config/config.go index 0dcabb1..1aebabd 100644 --- a/config/config.go +++ b/config/config.go @@ -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:"长轮询等待时间(秒)"` diff --git a/internal/app/api/ws.go b/internal/app/api/ws.go index 442f29f..5dc261a 100644 --- a/internal/app/api/ws.go +++ b/internal/app/api/ws.go @@ -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) - } - }() }