Reputation: 59
Is there a way to specify timeout per grpc call with python. I am experiencing more than 1 minute delay in receiving response. I want the api to return some error in case it is taking longer that specified time. I am using blocking grpc call.
Upvotes: 3
Views: 3052
Reputation: 2091
You can look up the information you want at gRPC Python's API reference. Setting timeout should be as simple as:
channel = grpc.insecure_channel(...)
stub = ...(channel)
stub.AnRPC(request, timeout=5) # 5 seconds timeout
Upvotes: 3