From cb2b7f29f9371847904972ad692a5002cb7cdc28 Mon Sep 17 00:00:00 2001 From: jmacxx <47253594+jmacxx@users.noreply.github.com> Date: Fri, 8 Jul 2022 09:04:43 -0500 Subject: [PATCH] Show last successful response time. --- .../bisq/inventory/InventoryWebServer.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/inventory/src/main/java/bisq/inventory/InventoryWebServer.java b/inventory/src/main/java/bisq/inventory/InventoryWebServer.java index e267fed8ce..cb3bf6f9b4 100644 --- a/inventory/src/main/java/bisq/inventory/InventoryWebServer.java +++ b/inventory/src/main/java/bisq/inventory/InventoryWebServer.java @@ -242,6 +242,8 @@ public class InventoryWebServer { sb.append("Response received at: ").append(responseTime).append("
"); sb.append(getErrorMsgLine(seedNode, requestInfo, map)); + + sb.append(getLastSuccessfulResponseLine(seedNode, map)); return sb.toString(); } @@ -531,4 +533,20 @@ public class InventoryWebServer { historicalErrorsHtml + CLOSE_TAG; } + + private String getLastSuccessfulResponseLine(NodeAddress seedNode, + Map> map) { + long newestResponseTime = 0; + List requestInfoList = map.get(seedNode); + if (requestInfoList != null) { + for (int i = 0; i < requestInfoList.size(); i++) { + RequestInfo requestInfo1 = requestInfoList.get(i); + newestResponseTime = Math.max(newestResponseTime, requestInfo1.getResponseTime()); + } + } + String responseMessage = newestResponseTime > 0 ? new Date(newestResponseTime).toString() : "none"; + return "Last response received: " + + responseMessage + + CLOSE_TAG; + } }