Reputation: 1
I used asynchronous C++ client for gRPC,but I can't set timeout for each request,when I used synchronous client, I can set the timeout through the ClientContext.set_deadline(),but this method does not take effect in asynchronous client;
I worried about when the gRPC server crash, then some request will be in the completion queue for ever, however I hope that when the request in the completion queue did not receive a response within a specified period of time , then it can notify that the request is timeout.
how can I achieve this goal?
waiting for your answer, thank you!
Upvotes: 0
Views: 1323
Reputation: 537
I am not sure I understand the issue completely, but you should be able to set the deadline for the RPC using set_deadline on the ClientContext before you start the call. After the deadline expires, the completion queue Next operation should return with a timeout.
Upvotes: 0