Log the number of common blocks found in each search.

This commit is contained in:
CalDescent 2021-04-18 13:02:38 +01:00
parent 3c22a12cbb
commit 2d2bfc0a4c

View File

@ -110,6 +110,7 @@ public class Synchronizer {
LOGGER.debug(String.format("Searching for common blocks with %d peers...", peers.size()));
final long startTime = System.currentTimeMillis();
int commonBlocksFound = 0;
for (Peer peer : peers) {
// Are we shutting down?
@ -135,10 +136,12 @@ public class Synchronizer {
// Search for the common block
Synchronizer.getInstance().findCommonBlockWithPeer(peer, repository);
if (peer.getCommonBlockData() != null)
commonBlocksFound++;
}
final long totalTimeTaken = System.currentTimeMillis() - startTime;
LOGGER.info(String.format("Finished searching for common blocks with %d peer%s. Total time taken: %d ms", peers.size(), (peers.size() != 1 ? "s" : ""), 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;
} finally {