问题
I'm using gRPC to call a service in client. After I set up channel:
channel = grpc.insecure_channel('server_url:service_port')
stub = Client.Stub(channel)
It works pretty good. However, if there's 5 minutes not using the client to send request, then the next request will get error message:
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.UNKNOWN, Stream removed)>
回答1:
Unfortunately the gRPC retries functionality when the channel breaks is still work in progress and not fully available yet. One thing you could do as a workaround is to write an interceptor to retry automatically if it sees such error.
来源:https://stackoverflow.com/questions/50689396/grpc-python-how-to-add-idle-time-for-client