Improve logs for block requests

This commit is contained in:
djing chan 2023-11-19 15:22:38 +07:00
parent c8fd897e54
commit 536a29f76a
No known key found for this signature in database
GPG Key ID: E87DCA978E5DED30
3 changed files with 10 additions and 8 deletions

View File

@ -128,7 +128,7 @@ public class RequestBlocksHandler implements MessageListener {
},
TIMEOUT_MIN, TimeUnit.MINUTES);
log.info("We request blocks from peer {} from block height {}.", nodeAddress, getBlocksRequest.getFromBlockHeight());
log.info("\n\n>> We request blocks from peer {} from block height {}.\n", nodeAddress, getBlocksRequest.getFromBlockHeight());
networkNode.addMessageListener(this);
@ -136,7 +136,7 @@ public class RequestBlocksHandler implements MessageListener {
Futures.addCallback(future, new FutureCallback<>() {
@Override
public void onSuccess(Connection connection) {
log.info("Sending of GetBlocksRequest message to peer {} succeeded.", nodeAddress.getFullAddress());
log.debug("Sending of GetBlocksRequest message to peer {} succeeded.", nodeAddress.getFullAddress());
}
@Override
@ -190,7 +190,9 @@ public class RequestBlocksHandler implements MessageListener {
}
terminate();
log.info("We received from peer {} a BlocksResponse with {} blocks",
log.info("\n#################################################################\n" +
"We received from peer {} a BlocksResponse with {} blocks" +
"\n#################################################################\n",
nodeAddress.getFullAddress(), getBlocksResponse.getBlocks().size());
listener.onComplete(getBlocksResponse);
}

View File

@ -75,7 +75,7 @@ public final class GetBlocksResponse extends NetworkEnvelope implements DirectMe
List<RawBlock> list = proto.getRawBlocksList().stream()
.map(RawBlock::fromProto)
.collect(Collectors.toList());
log.info("Received a GetBlocksResponse with {} blocks and {} kB size", list.size(), proto.getSerializedSize() / 1000d);
log.info("\n\n<< Received a GetBlocksResponse with {} blocks and {} kB size\n", list.size(), proto.getSerializedSize() / 1000d);
return new GetBlocksResponse(proto.getRawBlocksList().isEmpty() ?
new ArrayList<>() :
list,

View File

@ -364,15 +364,15 @@ public class RequestDataManager implements MessageListener, ConnectionListener,
log.info("DataResponse did not contain all data, so we repeat request until we got all data");
UserThread.runAfter(() -> requestData(nodeAddress, remainingNodeAddresses), 2);
} else {
log.warn("#################################################################\n" +
log.warn("\n#################################################################\n" +
"Loading initial data did not complete after 20 repeated requests. \n" +
"#################################################################");
"#################################################################\n");
checkNotNull(listener).onDataReceived();
}
} else {
log.info("#################################################################\n" +
log.info("\n#################################################################\n" +
"Loading initial data completed\n" +
"#################################################################");
"#################################################################\n");
checkNotNull(listener).onDataReceived();
}
}