mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +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
|
||||
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 double price;
|
||||
|
|
|
@ -39,6 +39,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
@ -324,12 +325,19 @@ public class PriceFeedService {
|
|||
priceConsumer.accept(marketPrice.getPrice());
|
||||
result = true;
|
||||
} else {
|
||||
errorMessage = "Price for currency " + currencyCode + " is outdated. marketPrice= " +
|
||||
marketPrice + " priceProvider=" + baseUrl;
|
||||
errorMessage = "Price for currency " + currencyCode + " is outdated by " +
|
||||
(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 {
|
||||
log.info("Market price for currency " + currencyCode + " is not provided by the provider " +
|
||||
baseUrl + ". That is expected for currencies not listed at providers.");
|
||||
if (baseUrlOfRespondingProvider == null)
|
||||
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;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
|
|
Loading…
Add table
Reference in a new issue