Fix load manager buglets.

This commit is contained in:
JoelKatz
2013-03-10 19:05:22 -07:00
parent 8d660736a8
commit 9cafb7a2a6
2 changed files with 3 additions and 3 deletions

View File

@@ -152,7 +152,7 @@ bool LoadManager::shouldCutoff(LoadSource& source) const
boost::mutex::scoped_lock sl(mLock); boost::mutex::scoped_lock sl(mLock);
int now = upTime(); int now = upTime();
canonicalize(source, now); canonicalize(source, now);
if (!source.isPrivileged() || (source.mBalance > mDebitLimit)) if (source.isPrivileged() || (source.mBalance > mDebitLimit))
return false; return false;
} }
logDisconnect(source.getName()); logDisconnect(source.getName());

View File

@@ -110,7 +110,7 @@ public:
jvResult["id"] = jvRequest["id"]; jvResult["id"] = jvRequest["id"];
} }
theApp->getLoadManager().adjust(mLoadSource, 5); theApp->getLoadManager().adjust(mLoadSource, -5);
return jvResult; return jvResult;
} }
@@ -131,7 +131,7 @@ public:
jvResult["result"] = mRPCHandler.doCommand(jvRequest, iRole, cost); jvResult["result"] = mRPCHandler.doCommand(jvRequest, iRole, cost);
} }
if (theApp->getLoadManager().adjust(mLoadSource, cost) && theApp->getLoadManager().shouldWarn(mLoadSource)) if (theApp->getLoadManager().adjust(mLoadSource, -cost) && theApp->getLoadManager().shouldWarn(mLoadSource))
jvResult["warning"] = "load"; jvResult["warning"] = "load";
// Currently we will simply unwrap errors returned by the RPC // Currently we will simply unwrap errors returned by the RPC