forked from Qortal/qortal
Reduced frequency and level of some synchronizer logs.
This commit is contained in:
parent
1ba64d9745
commit
3bedba71d5
@ -677,7 +677,7 @@ public class Controller extends Thread {
|
|||||||
peers.removeIf(hasInferiorChainTip);
|
peers.removeIf(hasInferiorChainTip);
|
||||||
|
|
||||||
final int peersRemoved = peersBeforeComparison - peers.size();
|
final int peersRemoved = peersBeforeComparison - peers.size();
|
||||||
if (peersRemoved > 0)
|
if (peersRemoved > 0 && peers.size() > 0)
|
||||||
LOGGER.info(String.format("Ignoring %d peers on inferior chains. Peers remaining: %d", peersRemoved, peers.size()));
|
LOGGER.info(String.format("Ignoring %d peers on inferior chains. Peers remaining: %d", peersRemoved, peers.size()));
|
||||||
|
|
||||||
if (peers.isEmpty())
|
if (peers.isEmpty())
|
||||||
|
@ -111,6 +111,7 @@ public class Synchronizer {
|
|||||||
LOGGER.debug(String.format("Searching for common blocks with %d peers...", peers.size()));
|
LOGGER.debug(String.format("Searching for common blocks with %d peers...", peers.size()));
|
||||||
final long startTime = System.currentTimeMillis();
|
final long startTime = System.currentTimeMillis();
|
||||||
int commonBlocksFound = 0;
|
int commonBlocksFound = 0;
|
||||||
|
boolean wereNewRequestsMade = false;
|
||||||
|
|
||||||
for (Peer peer : peers) {
|
for (Peer peer : peers) {
|
||||||
// Are we shutting down?
|
// Are we shutting down?
|
||||||
@ -131,10 +132,15 @@ public class Synchronizer {
|
|||||||
Synchronizer.getInstance().findCommonBlockWithPeer(peer, repository);
|
Synchronizer.getInstance().findCommonBlockWithPeer(peer, repository);
|
||||||
if (peer.getCommonBlockData() != null)
|
if (peer.getCommonBlockData() != null)
|
||||||
commonBlocksFound++;
|
commonBlocksFound++;
|
||||||
|
|
||||||
|
// This round wasn't served entirely from the cache, so we may want to log the results
|
||||||
|
wereNewRequestsMade = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wereNewRequestsMade) {
|
||||||
final long totalTimeTaken = System.currentTimeMillis() - startTime;
|
final long totalTimeTaken = System.currentTimeMillis() - startTime;
|
||||||
LOGGER.info(String.format("Finished searching for common blocks with %d peer%s. Found: %d. Total time taken: %d ms", peers.size(), (peers.size() != 1 ? "s" : ""), commonBlocksFound, totalTimeTaken));
|
LOGGER.info(String.format("Finished searching for common blocks with %d peer%s. Found: %d. Total time taken: %d ms", peers.size(), (peers.size() != 1 ? "s" : ""), commonBlocksFound, totalTimeTaken));
|
||||||
|
}
|
||||||
|
|
||||||
return SynchronizationResult.OK;
|
return SynchronizationResult.OK;
|
||||||
} finally {
|
} finally {
|
||||||
@ -294,7 +300,7 @@ public class Synchronizer {
|
|||||||
if (peer.canUseCachedCommonBlockData()) {
|
if (peer.canUseCachedCommonBlockData()) {
|
||||||
if (peer.getCommonBlockData().getBlockSummariesAfterCommonBlock() != null) {
|
if (peer.getCommonBlockData().getBlockSummariesAfterCommonBlock() != null) {
|
||||||
if (peer.getCommonBlockData().getBlockSummariesAfterCommonBlock().size() == summariesRequired) {
|
if (peer.getCommonBlockData().getBlockSummariesAfterCommonBlock().size() == summariesRequired) {
|
||||||
LOGGER.debug(String.format("Using cached block summaries for peer %s", peer));
|
LOGGER.trace(String.format("Using cached block summaries for peer %s", peer));
|
||||||
useCachedSummaries = true;
|
useCachedSummaries = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,14 +440,14 @@ public class Synchronizer {
|
|||||||
|
|
||||||
for (Peer peer : peers) {
|
for (Peer peer : peers) {
|
||||||
if (peer.getCommonBlockData() != null && peer.getCommonBlockData().getCommonBlockSummary() != null) {
|
if (peer.getCommonBlockData() != null && peer.getCommonBlockData().getCommonBlockSummary() != null) {
|
||||||
LOGGER.debug(String.format("Peer %s has common block %.8s", peer, Base58.encode(peer.getCommonBlockData().getCommonBlockSummary().getSignature())));
|
LOGGER.trace(String.format("Peer %s has common block %.8s", peer, Base58.encode(peer.getCommonBlockData().getCommonBlockSummary().getSignature())));
|
||||||
|
|
||||||
BlockSummaryData commonBlockSummary = peer.getCommonBlockData().getCommonBlockSummary();
|
BlockSummaryData commonBlockSummary = peer.getCommonBlockData().getCommonBlockSummary();
|
||||||
if (!commonBlocks.contains(commonBlockSummary))
|
if (!commonBlocks.contains(commonBlockSummary))
|
||||||
commonBlocks.add(commonBlockSummary);
|
commonBlocks.add(commonBlockSummary);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOGGER.debug(String.format("Peer %s has no common block data. Skipping...", peer));
|
LOGGER.trace(String.format("Peer %s has no common block data. Skipping...", peer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user