You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
con, err := grpc.NewClient(addr, opts...)
if err != nil {
return nil, fmt.Errorf("building client: %w", err)
}
con.Connect() // Although this does not block waiting for conn, and therefore never returns error
return con, nil
But this modifies our current behavior where we block and force the connection with the API before returning from the dialAPIServer function. This seems to be an anti pattern and we should just expect the connection to be established during the first rpc call, and be able to handle connection errors as a result of that call, which I believe we already do.
So, we can probably remove the blocking behavior from main and just expect the first gRPC service call to connect, because the agent will try to fetch data from the API when starting, that will happen early when initializing also, but I'm keeping this PR open by now to review this better.
grpc.Dial and grpc.DialContext are deprecated, although they will be supported throughout v1.x.x.
We use this to dial the API gRPC server during the agent initialization. The suggested way to do this is to replace this:
synthetic-monitoring-agent/cmd/synthetic-monitoring-agent/grpc.go
Line 43 in 83f8603
With something such as:
Or:
But this modifies our current behavior where we block and force the connection with the API before returning from the
dialAPIServer
function. This seems to be an anti pattern and we should just expect the connection to be established during the first rpc call, and be able to handle connection errors as a result of that call, which I believe we already do.So, we can probably remove the blocking behavior from main and just expect the first gRPC service call to connect, because the agent will try to fetch data from the API when starting, that will happen early when initializing also, but I'm keeping this PR open by now to review this better.
Originally posted by @ka3de in #671 (comment)
Introduced in: #706
The text was updated successfully, but these errors were encountered: