Skip to content

Commit

Permalink
Merge pull request #556 from AntelopeIO/GH-230-max-response-time
Browse files Browse the repository at this point in the history
Set keosd max http response time to unlimited
  • Loading branch information
heifner authored Dec 9, 2022
2 parents f2afae6 + b063ddc commit 0602269
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class beast_http_session : public detail::abstract_conn {
error_results results{static_cast<uint16_t>(http::status::not_found), "Not Found",
error_results::error_info( fc::exception( FC_LOG_MESSAGE( error, "Unknown Endpoint" ) ),
http_plugin::verbose_errors() )};
send_response( fc::json::to_string( results, fc::time_point::now() + plugin_state_->max_response_time ),
send_response( fc::json::to_string( results, fc::time_point::maximum() ),
static_cast<unsigned int>(http::status::not_found) );
}
} catch(...) {
Expand Down Expand Up @@ -311,27 +311,33 @@ class beast_http_session : public detail::abstract_conn {
} catch(const fc::exception& e) {
err_str = e.to_detail_string();
fc_elog(plugin_state_->logger, "fc::exception: ${w}", ("w", err_str));
error_results results{static_cast<uint16_t>(http::status::internal_server_error),
"Internal Service Error",
error_results::error_info( e, http_plugin::verbose_errors() )};
err_str = fc::json::to_string( results, fc::time_point::now() + plugin_state_->max_response_time );
if( is_send_exception_response_ ) {
error_results results{static_cast<uint16_t>(http::status::internal_server_error),
"Internal Service Error",
error_results::error_info( e, http_plugin::verbose_errors() )};
err_str = fc::json::to_string( results, fc::time_point::now() + plugin_state_->max_response_time );
}
} catch(std::exception& e) {
err_str = e.what();
fc_elog(plugin_state_->logger, "std::exception: ${w}", ("w", err_str));
error_results results{static_cast<uint16_t>(http::status::internal_server_error),
"Internal Service Error",
error_results::error_info( fc::exception( FC_LOG_MESSAGE( error, err_str )),
http_plugin::verbose_errors() )};
err_str = fc::json::to_string( results, fc::time_point::now() + plugin_state_->max_response_time );
if( is_send_exception_response_ ) {
error_results results{static_cast<uint16_t>(http::status::internal_server_error),
"Internal Service Error",
error_results::error_info( fc::exception( FC_LOG_MESSAGE( error, err_str ) ),
http_plugin::verbose_errors() )};
err_str = fc::json::to_string( results, fc::time_point::now() + plugin_state_->max_response_time );
}
} catch(...) {
err_str = "Unknown exception";
fc_elog(plugin_state_->logger, err_str);
error_results results{static_cast<uint16_t>(http::status::internal_server_error),
"Internal Service Error",
error_results::error_info(
fc::exception( FC_LOG_MESSAGE( error, err_str )),
http_plugin::verbose_errors() )};
err_str = fc::json::to_string( results, fc::time_point::now() + plugin_state_->max_response_time );
if( is_send_exception_response_ ) {
error_results results{static_cast<uint16_t>(http::status::internal_server_error),
"Internal Service Error",
error_results::error_info(
fc::exception( FC_LOG_MESSAGE( error, err_str ) ),
http_plugin::verbose_errors() )};
err_str = fc::json::to_string( results, fc::time_point::maximum() );
}
}
} catch (fc::timeout_exception& e) {
fc_elog( plugin_state_->logger, "Timeout exception ${te} attempting to handle exception: ${e}", ("te", e.to_detail_string())("e", err_str) );
Expand Down
2 changes: 1 addition & 1 deletion plugins/wallet_api_plugin/wallet_api_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using namespace eosio;
[&api_handle](string, string body, url_response_callback cb) mutable { \
try { \
INVOKE \
cb(http_response_code, fc::time_point::maximum(), fc::variant(result)); \
cb(http_response_code, fc::time_point::now() + fc::days(365), fc::variant(result)); \
} catch (...) { \
http_plugin::handle_exception(#api_name, #call_name, body, cb); \
} \
Expand Down

0 comments on commit 0602269

Please sign in to comment.