fix: 网元状态加ip/直连获取超时200毫秒
This commit is contained in:
@@ -15,13 +15,13 @@ import (
|
||||
)
|
||||
|
||||
// Get 发送 GET 请求
|
||||
// timeout 超时时间(秒)
|
||||
func Get(url string, headers map[string]string, timeout uint8) ([]byte, error) {
|
||||
if timeout < 1 || timeout > 180 {
|
||||
timeout = 1
|
||||
// timeout 超时时间(毫秒)
|
||||
func Get(url string, headers map[string]string, timeout int) ([]byte, error) {
|
||||
if timeout < 100 || timeout > 180_000 {
|
||||
timeout = 100
|
||||
}
|
||||
client := &http.Client{
|
||||
Timeout: time.Duration(timeout) * time.Second, // 设置超时时间为 5 秒
|
||||
Timeout: time.Duration(timeout) * time.Millisecond, // 超时时间
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
|
||||
Reference in New Issue
Block a user