mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-25 07:27:18 +01:00
Improve logs
This commit is contained in:
parent
cca9a62e3a
commit
9027db5c29
2 changed files with 13 additions and 5 deletions
|
@ -23,7 +23,7 @@ import java.time.Instant;
|
||||||
|
|
||||||
@Value
|
@Value
|
||||||
public class MarketPrice {
|
public class MarketPrice {
|
||||||
private static final long MARKET_PRICE_MAX_AGE_SEC = 1800; // 30 min
|
public static final long MARKET_PRICE_MAX_AGE_SEC = 1800; // 30 min
|
||||||
|
|
||||||
private final String currencyCode;
|
private final String currencyCode;
|
||||||
private final double price;
|
private final double price;
|
||||||
|
|
|
@ -39,6 +39,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
@ -324,12 +325,19 @@ public class PriceFeedService {
|
||||||
priceConsumer.accept(marketPrice.getPrice());
|
priceConsumer.accept(marketPrice.getPrice());
|
||||||
result = true;
|
result = true;
|
||||||
} else {
|
} else {
|
||||||
errorMessage = "Price for currency " + currencyCode + " is outdated. marketPrice= " +
|
errorMessage = "Price for currency " + currencyCode + " is outdated by " +
|
||||||
marketPrice + " priceProvider=" + baseUrl;
|
(Instant.now().getEpochSecond() - marketPrice.getTimestampSec()) / 60 + " minutes. " +
|
||||||
|
"Max. allowed age of price is " + MarketPrice.MARKET_PRICE_MAX_AGE_SEC / 60 + " minutes. " +
|
||||||
|
"priceProvider=" + baseUrl + ". " +
|
||||||
|
"marketPrice= " + marketPrice;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.info("Market price for currency " + currencyCode + " is not provided by the provider " +
|
if (baseUrlOfRespondingProvider == null)
|
||||||
baseUrl + ". That is expected for currencies not listed at providers.");
|
log.info("Market price for currency " + currencyCode + " was not delivered by provider " +
|
||||||
|
baseUrl + ". That is expected at startup.");
|
||||||
|
else
|
||||||
|
log.info("Market price for currency " + currencyCode + " is not provided by the provider " +
|
||||||
|
baseUrl + ". That is expected for currencies not listed at providers.");
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue