From d472d01e0262177f92b58d3bab3d89f8a4b99ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Bizjak?= Date: Fri, 13 Oct 2023 11:14:59 +0200 Subject: [PATCH] Documentation and changelog. --- CHANGELOG.md | 7 +++++++ concordium-node/src/grpc2.rs | 11 ++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2318f67867..3d61af929b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## Unreleased changes +## 6.1.7 + + - Add load-shedding to the V2 GRPC API. In particular, if at the time of the + request the node is already handling more than + `CONCORDIUM_NODE_GRPC2_MAX_CONCURRENT_REQUESTS` requests then the incoming + request will be immediately rejected. + ## 6.1.6 - Fix a regression in the start up time. When upgrading from an earlier version, the first start-up diff --git a/concordium-node/src/grpc2.rs b/concordium-node/src/grpc2.rs index 5fdef19f5d..2284ce2312 100644 --- a/concordium-node/src/grpc2.rs +++ b/concordium-node/src/grpc2.rs @@ -2613,13 +2613,14 @@ where // an Err(Overloaded). So record resource exhaustion // in the metrics. let (code, response) = if e.is::() { + // return a response with empty body of the correct type. `to_http` + // constructs a response with a `BoxBody` but + // here we need a more general one to make the service generic enough. let new_response = tonic::Status::resource_exhausted("Too many concurrent requests.") - .to_http(); - ( - tonic::Code::ResourceExhausted, - Ok(new_response.map(|_| Default::default())), - ) + .to_http() + .map(|_| Default::default()); + (tonic::Code::ResourceExhausted, Ok(new_response)) } else { (tonic::Code::Internal, Err(e)) };