Files
libsam/pkg/swqos/keep_alive.go

30 lines
412 B
Go
Raw Permalink Normal View History

2025-12-26 11:13:31 +08:00
package swqos
import (
"context"
"net/http"
"time"
)
func DoKeepAlive(ctx context.Context, url string) {
for {
select {
case <-ctx.Done():
return
case <-time.After(time.Second * 55):
}
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
continue
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
continue
}
resp.Body.Close()
}
}