python grpc超时机制有些疑问
来源:45-5 python下实现重试机制

城中城
2022-07-26
这里
https://www.yuque.com/bobby-zpcyu/fgmqcv/enncpo
我看完这节课 感觉有点问题 ( 可能后面几节课看完就迎刃而解 )
但是还是忍不住想问一下
python下超时重试机制
我加了个 打印 没出现重试这个机制啊
当你 设置了 超时参数后
with grpc.insecure_channel('localhost:50051') as channel:
intercept_channel = grpc.intercept_channel(channel, default_value_interceptor, retry_interceptor)
stub = helloworld_pb2_grpc.GreeterStub(intercept_channel)
response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'), timeout=1)
没等你重试 它就报错了 然后就结束进程了
导致你 重试根本没有任何用处
第二个 问题:
intercept_unary_stream 函数有什么用吗 起到了什么用处
看了过去 只看到 intercept_unary_unary 运行到了
写回答
1回答
-
intercept_unary_stream 是用于对stream接口进行拦截的,
没等你重试 它就报错了 然后就结束进程了 具体报错信息是什么
022022-07-29
相似问题