mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 23:15:52 +00:00
Clean up old acquires.
This commit is contained in:
@@ -275,6 +275,7 @@ void Application::sweep()
|
||||
mLedgerMaster.sweep();
|
||||
mTempNodeCache.sweep();
|
||||
mValidations.sweep();
|
||||
getMasterLedgerAcquire().sweep();
|
||||
mSweepTimer.expires_from_now(boost::posix_time::seconds(60));
|
||||
mSweepTimer.async_wait(boost::bind(&Application::sweep, this));
|
||||
}
|
||||
|
||||
@@ -724,4 +724,18 @@ bool LedgerAcquireMaster::isFailure(const uint256& hash)
|
||||
return mRecentFailures.find(hash) != mRecentFailures.end();
|
||||
}
|
||||
|
||||
void LedgerAcquireMaster::sweep()
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
|
||||
std::map<uint256, LedgerAcquire::pointer>::iterator it = mLedgers.begin();
|
||||
while (it != mLedgers.end())
|
||||
{
|
||||
if (it->second->isDone())
|
||||
mLedgers.erase(it++);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
@@ -133,6 +133,8 @@ public:
|
||||
|
||||
void logFailure(const uint256&);
|
||||
bool isFailure(const uint256&);
|
||||
|
||||
void sweep();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user