Better logging of rpcTOO_BUSY returns.

This commit is contained in:
JoelKatz
2013-03-08 13:44:12 -08:00
parent 51aa48d622
commit b71f16b8b8

View File

@@ -1152,6 +1152,13 @@ Json::Value RPCHandler::doRandom(Json::Value jvRequest, int& cost)
// - From a trusted server, allows clients to use path without manipulation. // - From a trusted server, allows clients to use path without manipulation.
Json::Value RPCHandler::doRipplePathFind(Json::Value jvRequest, int& cost) 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 raSrc;
RippleAddress raDst; RippleAddress raDst;
STAmount saDstAmount; STAmount saDstAmount;
@@ -1161,12 +1168,7 @@ Json::Value RPCHandler::doRipplePathFind(Json::Value jvRequest, int& cost)
if (!lpLedger) if (!lpLedger)
return jvResult; return jvResult;
if (theApp->getJobQueue().getJobCountGE(jtCLIENT) > 200) if (!jvRequest.isMember("source_account"))
{
cLog(lsDEBUG) << "Too busy for RPF";
jvResult = rpcError(rpcTOO_BUSY);
}
else if (!jvRequest.isMember("source_account"))
{ {
jvResult = rpcError(rpcSRC_ACT_MISSING); jvResult = rpcError(rpcSRC_ACT_MISSING);
} }
@@ -2892,10 +2894,14 @@ Json::Value RPCHandler::doCommand(const Json::Value& jvRequest, int iRole, int &
{ {
if (cost == 0) if (cost == 0)
cost = rpcCOST_DEFAULT; cost = rpcCOST_DEFAULT;
if ((iRole != ADMIN) && (theApp->getJobQueue().getJobCountGE(jtCLIENT) > 500)) if (iRole != ADMIN)
{ {
cLog(lsDEBUG) << "Too busy for command"; int jc = theApp->getJobQueue().getJobCountGE(jtCLIENT);
return rpcError(rpcTOO_BUSY); if (jc > 500)
{
cLog(lsDEBUG) << "Too busy for command: " << jc;
return rpcError(rpcTOO_BUSY);
}
} }
if (!jvRequest.isMember("command")) if (!jvRequest.isMember("command"))