我们向gRPC服务器发送多个请求。但是偶尔会出现“连接被对等方重置”错误,状态为“UNAVAILABLE”。
GRPC server: NestJS
Client: Python
Python version: 3.8
gRPCio version: 1.50.0
代码:
# Connect to server from client:
def connect_to_user_manager_server() -> AuthorizationControllerStub:
channel = grpc.insecure_channel(envs.USER_MANAGER_GRPC_URL, options=(
('grpc.keepalive_time_ms', 120000),
('grpc.keepalive_permit_without_calls', True),
))
stub = AuthorizationControllerStub(channel)
return stub
client = connect_to_user_manager_server()
user_response = client.CheckAuthorization(authorizationData(authorization=token, requiredRoles=roles))