mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 06:35:13 +01:00
Do not hammer CoinGecko with tests
This commit is contained in:
parent
ff11e6e032
commit
827b6085af
2 changed files with 10 additions and 2 deletions
|
@ -18,6 +18,14 @@ namespace BTCPayServer.Services.Rates
|
||||||
public string Exchange { get; set; }
|
public string Exchange { get; set; }
|
||||||
public string ExchangeName => Exchange ?? CoinGeckoName;
|
public string ExchangeName => Exchange ?? CoinGeckoName;
|
||||||
|
|
||||||
|
public bool CoinGeckoRate
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ExchangeName == CoinGeckoName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public CoinGeckoRateProvider(IHttpClientFactory httpClientFactory)
|
public CoinGeckoRateProvider(IHttpClientFactory httpClientFactory)
|
||||||
{
|
{
|
||||||
if (httpClientFactory == null)
|
if (httpClientFactory == null)
|
||||||
|
@ -31,7 +39,7 @@ namespace BTCPayServer.Services.Rates
|
||||||
|
|
||||||
public virtual Task<ExchangeRates> GetRatesAsync(CancellationToken cancellationToken)
|
public virtual Task<ExchangeRates> GetRatesAsync(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return ExchangeName == CoinGeckoName ? GetCoinGeckoRates() : GetCoinGeckoExchangeSpecificRates();
|
return CoinGeckoRate ? GetCoinGeckoRates() : GetCoinGeckoExchangeSpecificRates();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<ExchangeRates> GetCoinGeckoRates()
|
private async Task<ExchangeRates> GetCoinGeckoRates()
|
||||||
|
|
|
@ -2684,7 +2684,7 @@ noninventoryitem:
|
||||||
var all = string.Join("\r\n", factory.GetSupportedExchanges().Select(e => e.Id).ToArray());
|
var all = string.Join("\r\n", factory.GetSupportedExchanges().Select(e => e.Id).ToArray());
|
||||||
foreach (var result in factory
|
foreach (var result in factory
|
||||||
.Providers
|
.Providers
|
||||||
.Where(p => p.Value is BackgroundFetcherRateProvider)
|
.Where(p => p.Value is BackgroundFetcherRateProvider bf && !(bf.Inner is CoinGeckoRateProvider cg && !cg.CoinGeckoRate))
|
||||||
.Select(p => (ExpectedName: p.Key, ResultAsync: p.Value.GetRatesAsync(default), Fetcher: (BackgroundFetcherRateProvider)p.Value))
|
.Select(p => (ExpectedName: p.Key, ResultAsync: p.Value.GetRatesAsync(default), Fetcher: (BackgroundFetcherRateProvider)p.Value))
|
||||||
.ToList())
|
.ToList())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue