From b71f16b8b81f76c996929a9ce9d9165ddd04f32f Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 8 Mar 2013 13:44:12 -0800 Subject: [PATCH] Better logging of rpcTOO_BUSY returns. --- src/cpp/ripple/RPCHandler.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 03106fcc70..6277a88932 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -1152,6 +1152,13 @@ Json::Value RPCHandler::doRandom(Json::Value jvRequest, int& cost) // - From a trusted server, allows clients to use path without manipulation. Json::Value RPCHandler::doRipplePathFind(Json::Value jvRequest, int& cost) { + int jc = theApp->getJobQueue().getJobCountGE(jtCLIENT); + if (jc > 200) + { + cLog(lsDEBUG) << "Too busy for RPF: " << jc; + return rpcError(rpcTOO_BUSY); + } + RippleAddress raSrc; RippleAddress raDst; STAmount saDstAmount; @@ -1161,12 +1168,7 @@ Json::Value RPCHandler::doRipplePathFind(Json::Value jvRequest, int& cost) if (!lpLedger) return jvResult; - if (theApp->getJobQueue().getJobCountGE(jtCLIENT) > 200) - { - cLog(lsDEBUG) << "Too busy for RPF"; - jvResult = rpcError(rpcTOO_BUSY); - } - else if (!jvRequest.isMember("source_account")) + if (!jvRequest.isMember("source_account")) { jvResult = rpcError(rpcSRC_ACT_MISSING); } @@ -2892,10 +2894,14 @@ Json::Value RPCHandler::doCommand(const Json::Value& jvRequest, int iRole, int & { if (cost == 0) cost = rpcCOST_DEFAULT; - if ((iRole != ADMIN) && (theApp->getJobQueue().getJobCountGE(jtCLIENT) > 500)) + if (iRole != ADMIN) { - cLog(lsDEBUG) << "Too busy for command"; - return rpcError(rpcTOO_BUSY); + int jc = theApp->getJobQueue().getJobCountGE(jtCLIENT); + if (jc > 500) + { + cLog(lsDEBUG) << "Too busy for command: " << jc; + return rpcError(rpcTOO_BUSY); + } } if (!jvRequest.isMember("command"))