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

Setting a deadline for a request #68

Open
michaeldelago opened this issue Jun 21, 2024 · 0 comments
Open

Setting a deadline for a request #68

michaeldelago opened this issue Jun 21, 2024 · 0 comments

Comments

@michaeldelago
Copy link
Contributor

michaeldelago commented Jun 21, 2024

Something that seems to be missing is setting a deadline for a request. I can see that setting an infinite deadline is hardcoded into client.cc, but to my (limited) understanding, other grpc implementations (namely Go) take an infinite deadline to mean there isn't a deadline.

Is there a clean way that we can integrate deadlines into this implementation?

in the examples at grpc/grpc, python uses syntax like this (source):

try:
    response = stub.SayHello(
        helloworld_pb2.HelloRequest(name=message), timeout=3
    )
    print(f"Greeter client received: {response.message}")
except grpc.RpcError as rpc_error:
    print(f"Call failed with code: {rpc_error.code()}")

Noting that the syntax for python appears to be emitted from the python protobuf compiler, but that doesn't happen from cl-protobufs.

For CL, I suppose an equivalent would look like this

(handler-case
  (testing-rpc:call-say-hello channel (testing:make-hello-request :name message) :deadline 3)
 (grpc:grpc-call-error (c)
    (format t "call failed due to ~a" c)))

An alternative (and admittedly the first one I thought of) syntax for CL could use lexical variables:

(let ((grpc:*call-deadline* 3))
  (handler-case
    (testing-rpc:call-say-hello channel (testing:make-hello-request :name message))
   (grpc:grpc-call-error (c)
     (format t "call failed due to ~a" c))))

Thoughts? Am I missing on how to use deadlines in this library? If not, how can we implement it?

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

1 participant