summaryrefslogtreecommitdiff
path: root/http/http_client.hpp
diff options
context:
space:
mode:
authorCarson Labrado <clabrado@google.com>2022-11-09 03:25:20 +0300
committerEd Tanous <ed@tanous.net>2023-02-03 02:25:07 +0300
commit43e14d38178f6e9a362d2f066a05fecd41503d84 (patch)
tree693c95834c6c43d2d6d2080136af5777ff2c12d1 /http/http_client.hpp
parentd4413c5be6443f2983d6cad0f0bfe55fb820f147 (diff)
downloadbmcweb-43e14d38178f6e9a362d2f066a05fecd41503d84.tar.xz
Aggregation: Better handle dropped requests
It's possible for HTTP client's request buffer to become full (especially when $expand is used). Instead of ignoring the requests we should provide a 429 Too Many Requests response for the provided callback to process. The aggregator's response handling also needs to account for this possibility so that it only completely overwrites the asyncResp object when it receives a response from a satellite. Also added more test cases for the response processing functions. Tested: Unit tests passed Flooded aggregator with requests for satellite resources. Requests began returning 429 Too Many Requests errors after the request buffer became full. Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: Ib052dc0454d759de7fae761977ca26d6b8d208e5
Diffstat (limited to 'http/http_client.hpp')
-rw-r--r--http/http_client.hpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/http/http_client.hpp b/http/http_client.hpp
index 48e8cfdfac..a2cd62eb8d 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -775,8 +775,13 @@ class ConnectionPool : public std::enable_shared_from_this<ConnectionPool>
}
else
{
+ // If we can't buffer the request then we should let the callback
+ // handle a 429 Too Many Requests dummy response
BMCWEB_LOG_ERROR << destIP << ":" << std::to_string(destPort)
<< " request queue full. Dropping request.";
+ Response dummyRes;
+ dummyRes.result(boost::beast::http::status::too_many_requests);
+ resHandler(dummyRes);
}
}