mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Move ApplicationImp::Sweep from the aux thread to the job pool.
This commit is contained in:
@@ -28,8 +28,9 @@ enum JobType
|
|||||||
jtWRITE = 13, // Write out hashed objects
|
jtWRITE = 13, // Write out hashed objects
|
||||||
jtTRANSACTION_l = 14, // A local transaction
|
jtTRANSACTION_l = 14, // A local transaction
|
||||||
jtPROPOSAL_t = 15, // A proposal from a trusted source
|
jtPROPOSAL_t = 15, // A proposal from a trusted source
|
||||||
jtADMIN = 16, // An administrative operation
|
jtSWEEP = 16, // Sweep for stale structures
|
||||||
jtDEATH = 17, // job of death, used internally
|
jtADMIN = 17, // An administrative operation
|
||||||
|
jtDEATH = 18, // job of death, used internally
|
||||||
|
|
||||||
// special types not dispatched by the job pool
|
// special types not dispatched by the job pool
|
||||||
jtPEER = 24,
|
jtPEER = 24,
|
||||||
@@ -40,6 +41,7 @@ enum JobType
|
|||||||
jtPATH_FIND = 29,
|
jtPATH_FIND = 29,
|
||||||
jtHO_READ = 30,
|
jtHO_READ = 30,
|
||||||
jtHO_WRITE = 31,
|
jtHO_WRITE = 31,
|
||||||
|
jtGENERIC = 32, // Used just to measure time
|
||||||
}; // CAUTION: If you add new types, add them to JobType.cpp too
|
}; // CAUTION: If you add new types, add them to JobType.cpp too
|
||||||
|
|
||||||
// VFALCO TODO move this into the enum so it calculates itself?
|
// VFALCO TODO move this into the enum so it calculates itself?
|
||||||
|
|||||||
@@ -277,6 +277,7 @@ public:
|
|||||||
void run ();
|
void run ();
|
||||||
void stop ();
|
void stop ();
|
||||||
void sweep ();
|
void sweep ();
|
||||||
|
void doSweep (Job&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateTables ();
|
void updateTables ();
|
||||||
@@ -684,10 +685,17 @@ void ApplicationImp::sweep ()
|
|||||||
getApp().stop ();
|
getApp().stop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mJobQueue.addJob(jtSWEEP, "sweep",
|
||||||
|
BIND_TYPE(&ApplicationImp::doSweep, this, P_1));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApplicationImp::doSweep(Job& j)
|
||||||
|
{
|
||||||
// VFALCO NOTE Does the order of calls matter?
|
// VFALCO NOTE Does the order of calls matter?
|
||||||
// VFALCO TODO fix the dependency inversion using an observer,
|
// VFALCO TODO fix the dependency inversion using an observer,
|
||||||
// have listeners register for "onSweep ()" notification.
|
// have listeners register for "onSweep ()" notification.
|
||||||
//
|
//
|
||||||
|
|
||||||
mMasterTransaction.sweep ();
|
mMasterTransaction.sweep ();
|
||||||
m_nodeStore.sweep ();
|
m_nodeStore.sweep ();
|
||||||
mLedgerMaster.sweep ();
|
mLedgerMaster.sweep ();
|
||||||
@@ -698,7 +706,7 @@ void ApplicationImp::sweep ()
|
|||||||
AcceptedLedger::sweep (); // VFALCO NOTE AcceptedLedger is/has a singleton?
|
AcceptedLedger::sweep (); // VFALCO NOTE AcceptedLedger is/has a singleton?
|
||||||
SHAMap::sweep (); // VFALCO NOTE SHAMap is/has a singleton?
|
SHAMap::sweep (); // VFALCO NOTE SHAMap is/has a singleton?
|
||||||
mNetOps.sweepFetchPack ();
|
mNetOps.sweepFetchPack ();
|
||||||
// VFALCO NOTE does the call to sweep() happen on another thread?
|
|
||||||
mSweepTimer.expires_from_now (boost::posix_time::seconds (theConfig.getSize (siSweepInterval)));
|
mSweepTimer.expires_from_now (boost::posix_time::seconds (theConfig.getSize (siSweepInterval)));
|
||||||
mSweepTimer.async_wait (BIND_TYPE (&ApplicationImp::sweep, this));
|
mSweepTimer.async_wait (BIND_TYPE (&ApplicationImp::sweep, this));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user