From 08d06ac0f90fea75be9012119e1fb209f5f196bb Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Fri, 7 Jun 2024 17:53:47 +0200 Subject: [PATCH] wait for completion using allOf().joins() --- .../lndmanagej/service/ChannelDetailsService.java | 12 ++++++++++++ .../cotto/lndmanagej/service/NodeDetailsService.java | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/backend/src/main/java/de/cotto/lndmanagej/service/ChannelDetailsService.java b/backend/src/main/java/de/cotto/lndmanagej/service/ChannelDetailsService.java index 9940efaa..5f503dbb 100644 --- a/backend/src/main/java/de/cotto/lndmanagej/service/ChannelDetailsService.java +++ b/backend/src/main/java/de/cotto/lndmanagej/service/ChannelDetailsService.java @@ -66,6 +66,18 @@ public ChannelDetails getDetails(LocalChannel localChannel) { CompletableFuture channelWarnings = getChannelWarnings(localChannel); CompletableFuture> rating = getRating(channelId); try { + CompletableFuture.allOf( + remoteAlias, + balanceInformation, + onChainCosts, + policies, + feeReport, + flowReport, + rebalanceReport, + channelWarnings, + rating + ).join(); + return new ChannelDetails( localChannel, remoteAlias.get(), diff --git a/backend/src/main/java/de/cotto/lndmanagej/service/NodeDetailsService.java b/backend/src/main/java/de/cotto/lndmanagej/service/NodeDetailsService.java index e9d605aa..e8cdb000 100644 --- a/backend/src/main/java/de/cotto/lndmanagej/service/NodeDetailsService.java +++ b/backend/src/main/java/de/cotto/lndmanagej/service/NodeDetailsService.java @@ -78,6 +78,17 @@ public NodeDetails getDetails(Pubkey pubkey) { List forceClosingChannelIds = getSortedChannelIds(channelService.getForceClosingChannelsWith(pubkey)); try { + CompletableFuture.allOf( + node, + onlineReport, + onChainCosts, + balanceInformation, + feeReport, + flowReport, + rebalanceReport, + nodeWarnings, + rating + ).join(); return new NodeDetails( pubkey, node.get().alias(),