Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getinfobusyfix #161

Merged
merged 2 commits into from
May 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions plugins/http_plugin/http_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,11 @@ namespace eosio {

if( bytes_in_flight > max_bytes_in_flight ) {
dlog( "503 - too many bytes in flight: ${bytes}", ("bytes", bytes_in_flight.load()) );
error_results results{websocketpp::http::status_code::too_many_requests, "Busy", error_results::error_info()};
error_results::error_info ei;
ei.code = websocketpp::http::status_code::too_many_requests;
ei.name = "Busy";
ei.what = "Too many bytes in flight: " + std::to_string( bytes_in_flight );
error_results results{websocketpp::http::status_code::too_many_requests, "Busy", ei};
con->set_body( fc::json::to_string( results ));
con->set_status( websocketpp::http::status_code::too_many_requests );
return;
Expand All @@ -294,7 +298,6 @@ namespace eosio {
auto handler_itr = url_handlers.find( resource );
if( handler_itr != url_handlers.end()) {
con->defer_http_response();
bytes_in_flight += body.size();
handler_itr->second( resource, body, [&bytes_in_flight = this->bytes_in_flight, con]( int code, fc::variant response_body ) {
std::string json = fc::json::to_string( response_body );
response_body.clear();
Expand Down