frontend: add the abilities to customized timeout time (#51)

* main.go: add timeout setting

* lgproxy.go: use timeout setting when querying server

* README.md: add new timeout setting
This commit is contained in:
Nicolas Lorin
2022-02-08 09:29:05 +01:00
committed by GitHub
parent 950c018b18
commit 348295b9aa
3 changed files with 12 additions and 1 deletions

View File

@@ -47,7 +47,7 @@ func batchRequest(servers []string, endpoint string, command string) []string {
}
url := "http://" + hostname + ":" + strconv.Itoa(setting.proxyPort) + "/" + url.PathEscape(endpoint) + "?q=" + url.QueryEscape(command)
go func(url string, i int) {
client := http.Client{Timeout: 120 * time.Second}
client := http.Client{Timeout: time.Duration(setting.timeOut) * time.Second}
response, err := client.Get(url)
if err != nil {
ch <- channelData{i, "request failed: " + err.Error() + "\n"}