grpc c++ 设置断线重连时间
grpc客户端断线重连使用backoff机制
重连间隔越来越长
可以通过参数指定相关参数
相关参数:
https://grpc.github.io/grpc/core/group__grpc__arg__keys.html#gad7d9d143858d8f5e138cf704b0082973
相关代码:
::grpc_impl::ChannelArguments args; args.SetInt(GRPC_ARG_MAX_RECONNECT_BACKOFF_MS, 100); args.SetInt(GRPC_ARG_MIN_RECONNECT_BACKOFF_MS, 100); args.SetInt(GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS, 100); std::shared_ptr<grpc_impl::Channel> channel = grpc::CreateCustomChannel(car_ip + ":" + GRPC_NAVIGATE_API_PORT, grpc::InsecureChannelCredentials(), args);