Reduce lag timeouts

This commit is contained in:
miketout
2018-10-11 22:28:37 -07:00
parent af2e212d7a
commit 69fa3d0e00
2 changed files with 5 additions and 5 deletions

View File

@@ -929,8 +929,8 @@ int32_t waitForPeers(const CChainParams &chainparams)
do { do {
if (fvNodesEmpty) if (fvNodesEmpty)
MilliSleep(1000 + rand() % 4000);
{ {
MilliSleep(1000 + rand() % 4000);
boost::this_thread::interruption_point(); boost::this_thread::interruption_point();
LOCK(cs_vNodes); LOCK(cs_vNodes);
fvNodesEmpty = vNodes.empty(); fvNodesEmpty = vNodes.empty();
@@ -945,7 +945,7 @@ int32_t waitForPeers(const CChainParams &chainparams)
} }
else else
{ {
if (++loops <= 90) if (++loops <= 10)
{ {
MilliSleep(1000); MilliSleep(1000);
} }

View File

@@ -615,8 +615,8 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
do { do {
if (fvNodesEmpty) if (fvNodesEmpty)
MilliSleep(1000 + rand() % 4000);
{ {
MilliSleep(1000 + rand() % 4000);
LOCK(cs_vNodes); LOCK(cs_vNodes);
fvNodesEmpty = vNodes.empty(); fvNodesEmpty = vNodes.empty();
loops = 0; loops = 0;
@@ -630,7 +630,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
} }
else else
{ {
if (++loops <= 30) if (++loops <= 10)
{ {
MilliSleep(1000); MilliSleep(1000);
} }
@@ -638,7 +638,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
} }
} }
} while (fvNodesEmpty || IsNotInSync()); } while (fvNodesEmpty || IsNotInSync());
if (loops > 30) if (loops > 10)
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Cannot get a block template while no peers are connected or chain not in sync!"); throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Cannot get a block template while no peers are connected or chain not in sync!");
} }