Skip to content
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

Use improved grpc endpoint retrieval in client construction #61

Open
cbrit opened this issue Jun 21, 2022 · 2 comments
Open

Use improved grpc endpoint retrieval in client construction #61

cbrit opened this issue Jun 21, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@cbrit
Copy link
Member

cbrit commented Jun 21, 2022

No description provided.

@cbrit cbrit added the enhancement New feature or request label Jun 21, 2022
@AlianBenabdallah
Copy link

Is there any update regarding this issue ?

In order to implement a new feature for Hermes, we need to retrieve a grpc_address. It looks like get_chain_config() could provide a grpc address but currently does not. Is there currently a way to retrieve a grpc address ?

@cbrit
Copy link
Member Author

cbrit commented Aug 3, 2022

@AlianBenabdallah thanks for your question. Currently the client will only attempt to retrieve a healthy gRPC endpoint from the registry when a query is attempted

match self.get_random_grpc_endpoint().await {

It sounds like you need to endpoint ahead of time for your own purposes. There are two options that I can immediately think of:

  1. You can use any of the grpc endoint retrieval methods that exist on the client located in ocular::chain::client::grpc, as they are public methods.
// Gets every gRPC endpoint defined for a chain
let grpc = client.get_all_grpc_endpoints().await?;

// Attempts to get only the "healthy" endpoints
let grpc = client.get_grpc_endpoints().await?;

// Return a single, healthy endpoint. This uses the other two methods internally.
let grpc = client.get_random_grpc_endpoint().await?;

A warning though that we have seen inconsistent results with the health check, it apparently needs to be more robust. Sometimes even though a client connection can be established, queries may fail.

  1. If that option isn't adequate or user-friendly, please suggest your desired API and we can make it happen quickly. This can be as simple as setting a grpc endpoint in the config in the location you suggested, no problem.

The client construction and endpoint management are key features that I feel could improve a lot. I value your feedback! Please let me know what you like and don't like as you use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants