Set response time only in non error case

This commit is contained in:
chimp1984 2020-11-08 16:00:39 -05:00
parent 16880b2f6a
commit 86a853bfb9
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3

View File

@ -154,16 +154,17 @@ public class InventoryMonitor implements SetupListener {
RequestInfo requestInfo,
@Nullable Map<InventoryItem, String> result,
@Nullable String errorMessage) {
if (errorMessage != null) {
long responseTime = System.currentTimeMillis();
if (errorMessage != null && !errorMessage.isEmpty()) {
log.warn("Error at connection to peer {}: {}", nodeAddress, errorMessage);
requestInfo.setErrorMessage(errorMessage);
} else {
requestInfo.setResponseTime(responseTime);
}
boolean ignoreDeviationAtStartup;
if (result != null) {
log.info("nodeAddress={}, result={}", nodeAddress, result.toString());
long responseTime = System.currentTimeMillis();
requestInfo.setResponseTime(responseTime);
// If seed just started up we ignore the deviation as it can be expected that seed is still syncing
// DAO state/blocks. P2P data should be ready but as we received it from other seeds it is not that