diff --git a/core/src/main/java/bisq/core/app/DomainInitialisation.java b/core/src/main/java/bisq/core/app/DomainInitialisation.java index 43168a3e68..a9e593149c 100644 --- a/core/src/main/java/bisq/core/app/DomainInitialisation.java +++ b/core/src/main/java/bisq/core/app/DomainInitialisation.java @@ -216,6 +216,7 @@ public class DomainInitialisation { signedWitnessService.onAllServicesInitialized(); priceFeedService.setCurrencyCodeOnInit(); + priceFeedService.startRequestingPrices(); filterManager.setFilterWarningHandler(filterWarningHandler); filterManager.onAllServicesInitialized(); diff --git a/core/src/main/java/bisq/core/app/P2PNetworkSetup.java b/core/src/main/java/bisq/core/app/P2PNetworkSetup.java index bf871c28a7..b9c5d76063 100644 --- a/core/src/main/java/bisq/core/app/P2PNetworkSetup.java +++ b/core/src/main/java/bisq/core/app/P2PNetworkSetup.java @@ -149,7 +149,7 @@ public class P2PNetworkSetup { // We want to get early connected to the price relay so we call it already now priceFeedService.setCurrencyCodeOnInit(); - priceFeedService.initialRequestPriceFeed(); + priceFeedService.requestPrices(); } @Override diff --git a/core/src/main/java/bisq/core/provider/price/PriceFeedService.java b/core/src/main/java/bisq/core/provider/price/PriceFeedService.java index f2c44d96b8..0f006458a0 100644 --- a/core/src/main/java/bisq/core/provider/price/PriceFeedService.java +++ b/core/src/main/java/bisq/core/provider/price/PriceFeedService.java @@ -137,7 +137,7 @@ public class PriceFeedService { } } - public void initialRequestPriceFeed() { + public void requestPrices() { request(false); } @@ -145,11 +145,14 @@ public class PriceFeedService { return !cache.isEmpty(); } - public void requestPriceFeed(Consumer resultHandler, FaultHandler faultHandler) { + public void startRequestingPrices() { + if (requestTimer == null) request(true); // ignore if already repeat requesting + } + + public void startRequestingPrices(Consumer resultHandler, FaultHandler faultHandler) { this.priceConsumer = resultHandler; this.faultHandler = faultHandler; - - request(true); + startRequestingPrices(); } public String getProviderNodeAddress() { diff --git a/core/src/test/java/bisq/core/provider/price/MarketPriceFeedServiceTest.java b/core/src/test/java/bisq/core/provider/price/MarketPriceFeedServiceTest.java index 93ba4d43af..b8a6e6d412 100644 --- a/core/src/test/java/bisq/core/provider/price/MarketPriceFeedServiceTest.java +++ b/core/src/test/java/bisq/core/provider/price/MarketPriceFeedServiceTest.java @@ -33,7 +33,7 @@ public class MarketPriceFeedServiceTest { public void testGetPrice() throws InterruptedException { PriceFeedService priceFeedService = new PriceFeedService(null, null, null); priceFeedService.setCurrencyCode("EUR"); - priceFeedService.requestPriceFeed(tradeCurrency -> { + priceFeedService.startRequestingPrices(tradeCurrency -> { log.debug(tradeCurrency.toString()); assertTrue(true); }, diff --git a/desktop/src/main/java/bisq/desktop/main/presentation/MarketPricePresentation.java b/desktop/src/main/java/bisq/desktop/main/presentation/MarketPricePresentation.java index c1c627f065..2cd92cde54 100644 --- a/desktop/src/main/java/bisq/desktop/main/presentation/MarketPricePresentation.java +++ b/desktop/src/main/java/bisq/desktop/main/presentation/MarketPricePresentation.java @@ -132,7 +132,7 @@ public class MarketPricePresentation { } private void setupMarketPriceFeed() { - priceFeedService.requestPriceFeed(price -> marketPrice.set(FormattingUtils.formatMarketPrice(price, priceFeedService.getCurrencyCode())), + priceFeedService.startRequestingPrices(price -> marketPrice.set(FormattingUtils.formatMarketPrice(price, priceFeedService.getCurrencyCode())), (errorMessage, throwable) -> marketPrice.set(Res.get("shared.na"))); marketPriceBinding = EasyBind.combine( diff --git a/statsnode/src/main/java/bisq/statistics/Statistics.java b/statsnode/src/main/java/bisq/statistics/Statistics.java index 9f01013688..9c35066b30 100644 --- a/statsnode/src/main/java/bisq/statistics/Statistics.java +++ b/statsnode/src/main/java/bisq/statistics/Statistics.java @@ -58,7 +58,7 @@ public class Statistics { public void onUpdatedDataReceived() { // we need to have tor ready log.info("onBootstrapComplete: we start requestPriceFeed"); - priceFeedService.requestPriceFeed(price -> log.info("requestPriceFeed. price=" + price), + priceFeedService.startRequestingPrices(price -> log.info("requestPriceFeed. price=" + price), (errorMessage, throwable) -> log.warn("Exception at requestPriceFeed: " + throwable.getMessage())); tradeStatisticsManager.onAllServicesInitialized();