New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: context deadline exceeded (Client.Timeout exceeded while awaiting headers)
#646
Comments
change to: cli := resty.New().SetTimeout(20 * time.Second)
func service(query string) {
resp, err := cli.R().
EnableTrace().
SetFormData(map[string]string{
"query": query,
}).
Post("xxx")
} then succeed. The error will no longer occur |
1GB mem, 1core cpu server |
@daidai21 typically, creating a resty client once and firing N no. of request using that client is recommended. |
I encountered the same case when I followed the second example as well. Moreover, why does the first example result in an error, instead of giving a warning tip? This is quite frustrating. |
Sorry, the issue I am encountering is likely due to network instability caused by IDC. |
This IDC provides a dynamic IP server, so it should be a old problem(network problems when switching IP). |
ChatGPT suggests setting DisableKeepAlives in the transport:
It works well. |
when use like this:
out: (occasionally)
context deadline exceeded (Client.Timeout exceeded while awaiting headers)
The text was updated successfully, but these errors were encountered: