mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-30 18:28:52 -04:00
fetch prices repeatedly when run as daemon
This commit is contained in:
parent
a3a5b96c06
commit
a5f457d8e9
6 changed files with 12 additions and 8 deletions
|
@ -216,6 +216,7 @@ public class DomainInitialisation {
|
|||
signedWitnessService.onAllServicesInitialized();
|
||||
|
||||
priceFeedService.setCurrencyCodeOnInit();
|
||||
priceFeedService.startRequestingPrices();
|
||||
|
||||
filterManager.setFilterWarningHandler(filterWarningHandler);
|
||||
filterManager.onAllServicesInitialized();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<Double> resultHandler, FaultHandler faultHandler) {
|
||||
public void startRequestingPrices() {
|
||||
if (requestTimer == null) request(true); // ignore if already repeat requesting
|
||||
}
|
||||
|
||||
public void startRequestingPrices(Consumer<Double> resultHandler, FaultHandler faultHandler) {
|
||||
this.priceConsumer = resultHandler;
|
||||
this.faultHandler = faultHandler;
|
||||
|
||||
request(true);
|
||||
startRequestingPrices();
|
||||
}
|
||||
|
||||
public String getProviderNodeAddress() {
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue