mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Move UNL timer processing to the JobQueue
This commit is contained in:
@@ -100,36 +100,48 @@ public:
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void doScore ()
|
||||
{
|
||||
mtpScoreNext = boost::posix_time::ptime (boost::posix_time::not_a_date_time); // Timer not set.
|
||||
mtpScoreStart = boost::posix_time::second_clock::universal_time (); // Scoring.
|
||||
|
||||
WriteLog (lsTRACE, UniqueNodeList) << "Scoring: Start";
|
||||
|
||||
scoreCompute ();
|
||||
|
||||
WriteLog (lsTRACE, UniqueNodeList) << "Scoring: End";
|
||||
|
||||
// Save update time.
|
||||
mtpScoreUpdated = mtpScoreStart;
|
||||
miscSave ();
|
||||
|
||||
mtpScoreStart = boost::posix_time::ptime (boost::posix_time::not_a_date_time); // Not scoring.
|
||||
|
||||
// Score again if needed.
|
||||
scoreNext (false);
|
||||
|
||||
// Scan may be dirty due to new ips.
|
||||
getApp().getPeers ().scanRefresh ();
|
||||
}
|
||||
|
||||
void doFetch ()
|
||||
{
|
||||
// Time to check for another fetch.
|
||||
WriteLog (lsTRACE, UniqueNodeList) << "fetchTimerHandler";
|
||||
fetchNext ();
|
||||
}
|
||||
|
||||
void onDeadlineTimer (DeadlineTimer& timer)
|
||||
{
|
||||
if (timer == m_scoreTimer)
|
||||
{
|
||||
mtpScoreNext = boost::posix_time::ptime (boost::posix_time::not_a_date_time); // Timer not set.
|
||||
mtpScoreStart = boost::posix_time::second_clock::universal_time (); // Scoring.
|
||||
|
||||
WriteLog (lsTRACE, UniqueNodeList) << "Scoring: Start";
|
||||
|
||||
scoreCompute ();
|
||||
|
||||
WriteLog (lsTRACE, UniqueNodeList) << "Scoring: End";
|
||||
|
||||
// Save update time.
|
||||
mtpScoreUpdated = mtpScoreStart;
|
||||
miscSave ();
|
||||
|
||||
mtpScoreStart = boost::posix_time::ptime (boost::posix_time::not_a_date_time); // Not scoring.
|
||||
|
||||
// Score again if needed.
|
||||
scoreNext (false);
|
||||
|
||||
// Scan may be dirty due to new ips.
|
||||
getApp().getPeers ().scanRefresh ();
|
||||
getApp().getJobQueue ().addJob (jtUNL, "UNL.score",
|
||||
BIND_TYPE (&UniqueNodeListImp::doScore, this));
|
||||
}
|
||||
else if (timer == m_fetchTimer)
|
||||
{
|
||||
// Time to check for another fetch.
|
||||
WriteLog (lsTRACE, UniqueNodeList) << "fetchTimerHandler";
|
||||
fetchNext ();
|
||||
getApp().getJobQueue ().addJob (jtUNL, "UNL.fetch",
|
||||
BIND_TYPE (&UniqueNodeListImp::doFetch, this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ const char* Job::toString (JobType t)
|
||||
case jtUPDATE_PF: return "updatePaths";
|
||||
case jtCLIENT: return "clientCommand";
|
||||
case jtTRANSACTION: return "transaction";
|
||||
case jtUNL: return "unl";
|
||||
case jtADVANCE: return "advanceLedger";
|
||||
case jtPUBLEDGER: return "publishNewLedger";
|
||||
case jtTXN_DATA: return "fetchTxnData";
|
||||
|
||||
@@ -23,17 +23,18 @@ enum JobType
|
||||
jtUPDATE_PF = 8, // Update pathfinding requests
|
||||
jtCLIENT = 9, // A websocket command from the client
|
||||
jtTRANSACTION = 10, // A transaction received from the network
|
||||
jtADVANCE = 11, // Advance validated/acquired ledgers
|
||||
jtPUBLEDGER = 12, // Publish a fully-accepted ledger
|
||||
jtTXN_DATA = 13, // Fetch a proposed set
|
||||
jtWAL = 14, // Write-ahead logging
|
||||
jtVALIDATION_t = 15, // A validation from a trusted source
|
||||
jtWRITE = 16, // Write out hashed objects
|
||||
jtPROPOSAL_t = 17, // A proposal from a trusted source
|
||||
jtSWEEP = 18, // Sweep for stale structures
|
||||
jtNETOP_CLUSTER = 19, // NetworkOPs cluster peer report
|
||||
jtNETOP_TIMER = 20, // NetworkOPs net timer processing
|
||||
jtADMIN = 21, // An administrative operation
|
||||
jtUNL = 11, // A Score or Fetch of the UNL (DEPRECATED)
|
||||
jtADVANCE = 12, // Advance validated/acquired ledgers
|
||||
jtPUBLEDGER = 13, // Publish a fully-accepted ledger
|
||||
jtTXN_DATA = 14, // Fetch a proposed set
|
||||
jtWAL = 15, // Write-ahead logging
|
||||
jtVALIDATION_t = 16, // A validation from a trusted source
|
||||
jtWRITE = 17, // Write out hashed objects
|
||||
jtPROPOSAL_t = 18, // A proposal from a trusted source
|
||||
jtSWEEP = 19, // Sweep for stale structures
|
||||
jtNETOP_CLUSTER = 20, // NetworkOPs cluster peer report
|
||||
jtNETOP_TIMER = 21, // NetworkOPs net timer processing
|
||||
jtADMIN = 22, // An administrative operation
|
||||
|
||||
// special types not dispatched by the job pool
|
||||
jtPEER = 24,
|
||||
|
||||
Reference in New Issue
Block a user