-
Notifications
You must be signed in to change notification settings - Fork 691
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
provide a default timeout on http client #1405
Conversation
Thanks for your contribution. Can you show me what you passed to I do think your change makes sense. |
I assumed when I passed |
@jtarchie -- were you running an rqlite -s https
ERR! Get "https://127.0.0.1:4001//status": http: server gave HTTP response to HTTPS client and if nothing is running I get: rqlite -s https
ERR! Unable to connect to rqlited at https://127.0.0.1:4001 - is it running? |
Your example above is when it is run locally. The networking configuration for your host machine might account for timeouts, such as firewalls just dropping packets to any port not being listened on. For example,
I was running through GCP, behind a load balancer I don't control. This is a reproducible example if you are so inclined. |
Ack, thanks, I'll merge this (or something very similar) soon. |
I can make changes if you want. Please let me know. |
cmd/rqlite/main.go
Outdated
TLSClientConfig: &tls.Config{InsecureSkipVerify: argv.Insecure, RootCAs: rootCAs}, | ||
Proxy: http.ProxyFromEnvironment, | ||
}, | ||
Timeout: httpTimeout, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the timeout be configurable like the insecure
option too? e.g 30s
or something that can be parsed with time.ParseDuration
I thought that might be overkill, but the Go docs say this timeout affects all HTTP requests. So if retrieving backup took longer than the timeout (quite possible) it might break that. So yeah, let's add a timeout option. It would be: -t 10s Default to 30s? |
When using the `rqlite` CLI, I was unable to determine an issue of connection. It turns out that the arugments I had provided were not working. The issue did not present itself till I added a timeout to the HTTP client.
I used the built-in functionality of the CLI library. It can parse durations from the command line arguments. |
Thanks! |
When using the
rqlite
CLI, I could not determine an issue of connection. It turns out that the arguments I had provided were not working. The issue was not present until I added a timeout to the HTTP client.