gRPC Python - how to add idle time for client

拥有回忆 提交于 2021-01-28 09:04:44

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!