-
Notifications
You must be signed in to change notification settings - Fork 638
Product check: Improve retry mechanism #309
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
Product check: Improve retry mechanism #309
Conversation
Differentiate unspported/unknown products Typed Errors
@Anaethelion can you describe how this was happening before? This change seems complicated to me, and I don't understand why it's necessary. |
elasticsearch.go
Outdated
| checkHeader := func() error { | ||
| if res != nil { | ||
| return genuineCheckHeader(res.Header) | ||
| } | ||
| return nil | ||
| } |
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.
As we have already checked err == nil above, res must be non-nil according to net/http:
If the returned error is nil, the Response will contain a non-nil Body which the user is expected to close. If the Body is not both read to EOF and closed, the Client's underlying RoundTripper (typically Transport) may not be able to re-use a persistent TCP connection to the server for a subsequent "keep-alive" request.
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.
Nice catch, thanks for this! 👍
* Client: Improve product check Differentiate unspported/unknown products * Client: Handle http errors
This ensures the product check is not flagged wrongfully as successful if the answer has not been properly validated.
The client will retry product check until success or error.