Accept old ledgers acquired over the network at a lower priority.

This commit is contained in:
JoelKatz
2013-02-10 16:40:52 -08:00
parent 1c56e3b53a
commit a26a302476
3 changed files with 19 additions and 16 deletions

View File

@@ -11,11 +11,12 @@ SETUP_LOG();
JobQueue::JobQueue() : mLastJob(0), mThreadCount(0), mShuttingDown(false)
{
mJobLoads[jtPUBOLDLEDGER].setTargeLatency(10000, 15000);
mJobLoads[jtVALIDATION_ut].setTargetLatency(2000, 5000);
mJobLoads[jtPROOFWORK].setTargetLatency(2000, 5000);
mJobLoads[jtTRANSACTION].setTargetLatency(250, 1000);
mJobLoads[jtPROPOSAL_ut].setTargetLatency(500, 1250);
mJobLoads[jtPUBLEDGER].setTargetLatency(1000, 2500);
mJobLoads[jtPUBLEDGER].setTargetLatency(3000, 4500);
mJobLoads[jtWAL].setTargetLatency(1000, 2500);
mJobLoads[jtVALIDATION_t].setTargetLatency(500, 1500);
mJobLoads[jtWRITE].setTargetLatency(750, 1500);
@@ -35,12 +36,13 @@ const char* Job::toString(JobType t)
switch(t)
{
case jtINVALID: return "invalid";
case jtPUBOLDLEDGER: return "publishAcqLedger";
case jtVALIDATION_ut: return "untrustedValidation";
case jtPROOFWORK: return "proofOfWork";
case jtPROPOSAL_ut: return "untrustedProposal";
case jtCLIENT: return "clientCommand";
case jtTRANSACTION: return "transaction";
case jtPUBLEDGER: return "publishLedger";
case jtPUBLEDGER: return "publishNewLedger";
case jtVALIDATION_t: return "trustedValidation";
case jtWAL: return "writeAhead";
case jtWRITE: return "writeObjects";

View File

@@ -21,19 +21,20 @@
enum JobType
{ // must be in priority order, low to high
jtINVALID = -1,
jtVALIDATION_ut = 1, // A validation from an untrusted source
jtPROOFWORK = 2, // A proof of work demand from another server
jtPROPOSAL_ut = 3, // A proposal from an untrusted source
jtCLIENT = 4, // A websocket command from the client
jtTRANSACTION = 5, // A transaction received from the network
jtPUBLEDGER = 6, // Publish a fully-accepted ledger
jtWAL = 7, // Write-ahead logging
jtVALIDATION_t = 8, // A validation from a trusted source
jtWRITE = 9, // Write out hashed objects
jtTRANSACTION_l = 10, // A local transaction
jtPROPOSAL_t = 11, // A proposal from a trusted source
jtADMIN = 12, // An administrative operation
jtDEATH = 13, // job of death, used internally
jtPUBOLDLEDGER = 1, // An old ledger has been accepted
jtVALIDATION_ut = 2, // A validation from an untrusted source
jtPROOFWORK = 3, // A proof of work demand from another server
jtPROPOSAL_ut = 4, // A proposal from an untrusted source
jtCLIENT = 5, // A websocket command from the client
jtTRANSACTION = 6, // A transaction received from the network
jtPUBLEDGER = 7, // Publish a fully-accepted ledger
jtWAL = 8, // Write-ahead logging
jtVALIDATION_t = 9, // A validation from a trusted source
jtWRITE = 10, // Write out hashed objects
jtTRANSACTION_l = 11, // A local transaction
jtPROPOSAL_t = 12, // A proposal from a trusted source
jtADMIN = 13, // An administrative operation
jtDEATH = 14, // job of death, used internally
// special types not dispatched by the job pool
jtPEER = 17,

View File

@@ -173,7 +173,7 @@ bool LedgerMaster::acquireMissingLedger(Ledger::ref origLedger, const uint256& l
{
cLog(lsTRACE) << "Ledger hash found in database";
mTooFast = true;
theApp->getJobQueue().addJob(jtPUBLEDGER, boost::bind(&LedgerMaster::asyncAccept, this, ledger));
theApp->getJobQueue().addJob(jtPUBOLDLEDGER, boost::bind(&LedgerMaster::asyncAccept, this, ledger));
return true;
}