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:
@@ -13,7 +13,7 @@ SETUP_LOG (InboundLedger)
|
|||||||
#define LEDGER_TIMEOUT_AGGRESSIVE 6 // how many timeouts before we get aggressive
|
#define LEDGER_TIMEOUT_AGGRESSIVE 6 // how many timeouts before we get aggressive
|
||||||
|
|
||||||
InboundLedger::InboundLedger (uint256 const& hash, uint32 seq)
|
InboundLedger::InboundLedger (uint256 const& hash, uint32 seq)
|
||||||
: PeerSet (hash, LEDGER_ACQUIRE_TIMEOUT)
|
: PeerSet (hash, LEDGER_ACQUIRE_TIMEOUT, false)
|
||||||
, mHaveBase (false)
|
, mHaveBase (false)
|
||||||
, mHaveState (false)
|
, mHaveState (false)
|
||||||
, mHaveTransactions (false)
|
, mHaveTransactions (false)
|
||||||
|
|||||||
@@ -130,6 +130,9 @@ const char* Job::toString (JobType t)
|
|||||||
case jtTXN_PROC:
|
case jtTXN_PROC:
|
||||||
return "processTransaction";
|
return "processTransaction";
|
||||||
|
|
||||||
|
case jtTXN_DATA:
|
||||||
|
return "fetchTxnData";
|
||||||
|
|
||||||
case jtOB_SETUP:
|
case jtOB_SETUP:
|
||||||
return "orderBookSetup";
|
return "orderBookSetup";
|
||||||
|
|
||||||
|
|||||||
@@ -17,20 +17,21 @@ enum JobType
|
|||||||
jtPUBOLDLEDGER = 2, // An old ledger has been accepted
|
jtPUBOLDLEDGER = 2, // An old ledger has been accepted
|
||||||
jtVALIDATION_ut = 3, // A validation from an untrusted source
|
jtVALIDATION_ut = 3, // A validation from an untrusted source
|
||||||
jtPROOFWORK = 4, // A proof of work demand from another server
|
jtPROOFWORK = 4, // A proof of work demand from another server
|
||||||
jtPROPOSAL_ut = 5, // A proposal from an untrusted source
|
jtTRANSACTION_l = 5, // A local transaction
|
||||||
jtLEDGER_DATA = 6, // Received data for a ledger we're acquiring
|
jtPROPOSAL_ut = 6, // A proposal from an untrusted source
|
||||||
jtUPDATE_PF = 7, // Update pathfinding requests
|
jtLEDGER_DATA = 7, // Received data for a ledger we're acquiring
|
||||||
jtCLIENT = 8, // A websocket command from the client
|
jtUPDATE_PF = 8, // Update pathfinding requests
|
||||||
jtTRANSACTION = 9, // A transaction received from the network
|
jtCLIENT = 9, // A websocket command from the client
|
||||||
jtPUBLEDGER = 10, // Publish a fully-accepted ledger
|
jtTRANSACTION = 10, // A transaction received from the network
|
||||||
jtWAL = 11, // Write-ahead logging
|
jtPUBLEDGER = 11, // Publish a fully-accepted ledger
|
||||||
jtVALIDATION_t = 12, // A validation from a trusted source
|
jtTXN_DATA = 12, // Fetch a proposed set
|
||||||
jtWRITE = 13, // Write out hashed objects
|
jtWAL = 13, // Write-ahead logging
|
||||||
jtTRANSACTION_l = 14, // A local transaction
|
jtVALIDATION_t = 14, // A validation from a trusted source
|
||||||
jtPROPOSAL_t = 15, // A proposal from a trusted source
|
jtWRITE = 15, // Write out hashed objects
|
||||||
jtSWEEP = 16, // Sweep for stale structures
|
jtPROPOSAL_t = 16, // A proposal from a trusted source
|
||||||
jtADMIN = 17, // An administrative operation
|
jtSWEEP = 17, // Sweep for stale structures
|
||||||
jtDEATH = 18, // job of death, used internally
|
jtADMIN = 18, // An administrative operation
|
||||||
|
jtDEATH = 19, // 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,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
class InboundLedger;
|
class InboundLedger;
|
||||||
|
|
||||||
PeerSet::PeerSet (uint256 const& hash, int interval)
|
PeerSet::PeerSet (uint256 const& hash, int interval, bool txnData)
|
||||||
: mHash (hash)
|
: mHash (hash)
|
||||||
, mTimerInterval (interval)
|
, mTimerInterval (interval)
|
||||||
, mTimeouts (0)
|
, mTimeouts (0)
|
||||||
@@ -14,6 +14,7 @@ PeerSet::PeerSet (uint256 const& hash, int interval)
|
|||||||
, mFailed (false)
|
, mFailed (false)
|
||||||
, mProgress (true)
|
, mProgress (true)
|
||||||
, mAggressive (false)
|
, mAggressive (false)
|
||||||
|
, mTxnData (txnData)
|
||||||
, mTimer (getApp().getIOService ())
|
, mTimer (getApp().getIOService ())
|
||||||
{
|
{
|
||||||
mLastAction = UptimeTimer::getInstance ().getElapsedSeconds ();
|
mLastAction = UptimeTimer::getInstance ().getElapsedSeconds ();
|
||||||
@@ -74,16 +75,24 @@ void PeerSet::TimerEntry (boost::weak_ptr<PeerSet> wptr, const boost::system::er
|
|||||||
|
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
int jc = getApp().getJobQueue ().getJobCountTotal (jtLEDGER_DATA);
|
if (ptr->mTxnData)
|
||||||
|
|
||||||
if (jc > 4)
|
|
||||||
{
|
{
|
||||||
WriteLog (lsDEBUG, InboundLedger) << "Deferring PeerSet timer due to load";
|
getApp().getJobQueue ().addLimitJob (jtTXN_DATA, "timerEntry", 2,
|
||||||
ptr->setTimer ();
|
BIND_TYPE (&PeerSet::TimerJobEntry, P_1, ptr));
|
||||||
}
|
}
|
||||||
else
|
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
|
// VFALCO TODO try to make some of these private
|
||||||
protected:
|
protected:
|
||||||
PeerSet (uint256 const& hash, int interval);
|
PeerSet (uint256 const& hash, int interval, bool txnData);
|
||||||
virtual ~PeerSet () { }
|
virtual ~PeerSet () { }
|
||||||
|
|
||||||
virtual void newPeer (Peer::ref) = 0;
|
virtual void newPeer (Peer::ref) = 0;
|
||||||
@@ -95,6 +95,7 @@ protected:
|
|||||||
bool mFailed;
|
bool mFailed;
|
||||||
bool mProgress;
|
bool mProgress;
|
||||||
bool mAggressive;
|
bool mAggressive;
|
||||||
|
bool mTxnData;
|
||||||
int mLastAction;
|
int mLastAction;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ SETUP_LOG (TransactionAcquire)
|
|||||||
typedef std::map<uint160, LedgerProposal::pointer>::value_type u160_prop_pair;
|
typedef std::map<uint160, LedgerProposal::pointer>::value_type u160_prop_pair;
|
||||||
typedef std::map<uint256, DisputedTx::pointer>::value_type u256_lct_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);
|
mMap = boost::make_shared<SHAMap> (smtTRANSACTION, hash);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user