-
Notifications
You must be signed in to change notification settings - Fork 11
Mention caveat and fix for connections to data-server in golang #66
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
Mention caveat and fix for connections to data-server in golang #66
Conversation
Is this something we should add to the go example analyzer? |
Example analyzer doesn't keep an open connection to data server but opens a new one for each event. |
README.md
Outdated
@@ -38,6 +38,8 @@ When DataService is being dialed, you should: | |||
- turn off [gRPC fail-fast](https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md) mode if your analyzer creates a connection to DataServer before it was actually started. This way the RPCs are queued until the chanel is ready: | |||
- go: using `grpc.FailFast(false)` | |||
([example](https://github.com/src-d/lookout-gometalint-analyzer/blob/7b4b37fb3109299516fbb43017934d131784f49f/cmd/gometalint-analyzer/main.go#L66)). | |||
- golang: reset connection backoff to data server on event: | |||
if you keep connection to data server open you need to reset backoff when analyzer receives new event. Use conn.[ResetConnectBackoff](https://godoc.org/google.golang.org/grpc#ClientConn.ResetConnectBackoff) method in your event handlers. It's needed to avoid broken connection after lookoutd redeployment. In case of a long restart of lookoutd grpc backoff timeout may increase big enough so analyzer wouldn't reconnect before it makes request to data server. |
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.
A suggestion, same text with "DataServer" for consistency with the rest of the doc and more verbosity to make the reason more clear.
if you keep connection to data server open you need to reset backoff when analyzer receives new event. Use conn.[ResetConnectBackoff](https://godoc.org/google.golang.org/grpc#ClientConn.ResetConnectBackoff) method in your event handlers. It's needed to avoid broken connection after lookoutd redeployment. In case of a long restart of lookoutd grpc backoff timeout may increase big enough so analyzer wouldn't reconnect before it makes request to data server. | |
golang: reset connection backoff to DataServer on event: | |
if you keep the connection to DataServer open you need to reset the backoff when your analyzer receives a new event. Use the [`conn.ResetConnectBackoff`](https://godoc.org/google.golang.org/grpc#ClientConn.ResetConnectBackoff) method in your event handlers. It's needed to avoid broken connections after a `lookoutd` redeployment. In case of a long restart of `lookoutd` gRPC server, the backoff timeout may increase so much that the analyzer will not be able to reconnect before it makes the new request to DataServer. |
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.
updated
Signed-off-by: Maxim Sukharev <max@smacker.ru>
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.
LGTM. Is there any other repo where we should apply this? The dummy analyzer, gometalinter, etc?
All of them use a new connection for each request as far as I remember. We don't have any "production-ready" go analyzer which would keep an open connection. |
Ref: #64