mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 03:26:01 +00:00
Don't delay transaction fetches due to load, only ledger fetches.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
class InboundLedger;
|
||||
|
||||
PeerSet::PeerSet (uint256 const& hash, int interval)
|
||||
PeerSet::PeerSet (uint256 const& hash, int interval, bool txnData)
|
||||
: mHash (hash)
|
||||
, mTimerInterval (interval)
|
||||
, mTimeouts (0)
|
||||
@@ -14,6 +14,7 @@ PeerSet::PeerSet (uint256 const& hash, int interval)
|
||||
, mFailed (false)
|
||||
, mProgress (true)
|
||||
, mAggressive (false)
|
||||
, mTxnData (txnData)
|
||||
, mTimer (getApp().getIOService ())
|
||||
{
|
||||
mLastAction = UptimeTimer::getInstance ().getElapsedSeconds ();
|
||||
@@ -74,16 +75,24 @@ void PeerSet::TimerEntry (boost::weak_ptr<PeerSet> wptr, const boost::system::er
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
int jc = getApp().getJobQueue ().getJobCountTotal (jtLEDGER_DATA);
|
||||
|
||||
if (jc > 4)
|
||||
if (ptr->mTxnData)
|
||||
{
|
||||
WriteLog (lsDEBUG, InboundLedger) << "Deferring PeerSet timer due to load";
|
||||
ptr->setTimer ();
|
||||
getApp().getJobQueue ().addLimitJob (jtTXN_DATA, "timerEntry", 2,
|
||||
BIND_TYPE (&PeerSet::TimerJobEntry, P_1, ptr));
|
||||
}
|
||||
else
|
||||
getApp().getJobQueue ().addLimitJob (jtLEDGER_DATA, "timerEntry", 2,
|
||||
BIND_TYPE (&PeerSet::TimerJobEntry, P_1, ptr));
|
||||
{
|
||||
int jc = getApp().getJobQueue ().getJobCountTotal (jtLEDGER_DATA);
|
||||
|
||||
if (jc > 4)
|
||||
{
|
||||
WriteLog (lsDEBUG, InboundLedger) << "Deferring PeerSet timer due to load";
|
||||
ptr->setTimer ();
|
||||
}
|
||||
else
|
||||
getApp().getJobQueue ().addLimitJob (jtLEDGER_DATA, "timerEntry", 2,
|
||||
BIND_TYPE (&PeerSet::TimerJobEntry, P_1, ptr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
|
||||
// VFALCO TODO try to make some of these private
|
||||
protected:
|
||||
PeerSet (uint256 const& hash, int interval);
|
||||
PeerSet (uint256 const& hash, int interval, bool txnData);
|
||||
virtual ~PeerSet () { }
|
||||
|
||||
virtual void newPeer (Peer::ref) = 0;
|
||||
@@ -95,6 +95,7 @@ protected:
|
||||
bool mFailed;
|
||||
bool mProgress;
|
||||
bool mAggressive;
|
||||
bool mTxnData;
|
||||
int mLastAction;
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ SETUP_LOG (TransactionAcquire)
|
||||
typedef std::map<uint160, LedgerProposal::pointer>::value_type u160_prop_pair;
|
||||
typedef std::map<uint256, DisputedTx::pointer>::value_type u256_lct_pair;
|
||||
|
||||
TransactionAcquire::TransactionAcquire (uint256 const& hash) : PeerSet (hash, TX_ACQUIRE_TIMEOUT), mHaveRoot (false)
|
||||
TransactionAcquire::TransactionAcquire (uint256 const& hash)
|
||||
: PeerSet (hash, TX_ACQUIRE_TIMEOUT, true)
|
||||
, mHaveRoot (false)
|
||||
{
|
||||
mMap = boost::make_shared<SHAMap> (smtTRANSACTION, hash);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user