diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java index bd6445226b..76d5eb3839 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java @@ -50,7 +50,7 @@ public class PeerTaskExecutor { metricsSystem.createLabelledTimer( BesuMetricCategory.PEERS, "PeerTaskExecutor:RequestTime", - "Time taken to send a request", + "Time taken to send a request and receive a response", "className"); } @@ -95,13 +95,14 @@ public class PeerTaskExecutor { do { try { - MessageData responseMessageData; + T result ; try (final OperationTimer.TimingContext timingContext = requestTimer.labels(peerTask.getClass().getSimpleName()).startTimer()) { - responseMessageData = - requestSender.sendRequest(peerTask.getSubProtocol(), requestMessageData, peer); + MessageData responseMessageData = + requestSender.sendRequest(peerTask.getSubProtocol(), requestMessageData, peer); + + result = peerTask.parseResponse(responseMessageData); } - T result = peerTask.parseResponse(responseMessageData); peer.recordUsefulResponse(); executorResult = new PeerTaskExecutorResult<>(result, PeerTaskExecutorResponseCode.SUCCESS);