问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/57920099/python-grpc-setting-timeout-per-grpc-call