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

Question: purpose of the Grpc.Status.t returned with the Ok case. #39

Open
clembu opened this issue Aug 8, 2023 · 2 comments
Open

Question: purpose of the Grpc.Status.t returned with the Ok case. #39

clembu opened this issue Aug 8, 2023 · 2 comments

Comments

@clembu
Copy link

clembu commented Aug 8, 2023

Hello everyone.
I'm wondering why there's a status tupled with the rpc response, as a return to Client.call.

All the examples end up matching the result with

match response with
| Ok (response, _ok) -> ...
| Error error -> ...

As there are no examples showing a use case for this status, and all existing examples end up ignoring it, I am left wondering why it is given at all. Are there any cases where it is not the OK status? If so, which values can it be?

@quernd
Copy link
Collaborator

quernd commented Aug 8, 2023

Thanks for bringing this up! These are gRPC specific status codes. It is not necessarily the OK status, and it's up to you to handle it or not.

You're right, it would be good not to ignore this code in the examples. Feel free to modify the examples and open a PR, otherwise we'll get to it some time soon.

@tmcgilchrist
Copy link
Collaborator

An interesting example to add would be support for the gRPC health check API and implement a scenario like pausing calling a service when the health check stops responding then resuming when it is healthy again. I made an earlier start on it here https://github.com/tmcgilchrist/ocaml-grpc/tree/grpc_health_check with a view to implementing this example from Rust https://github.com/hyperium/tonic/tree/master/examples/src/health

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

No branches or pull requests

3 participants