diff --git a/BTCPayServer.Rating/Providers/KrakenExchangeRateProvider.cs b/BTCPayServer.Rating/Providers/KrakenExchangeRateProvider.cs index 08fe27536..2f1c5333d 100644 --- a/BTCPayServer.Rating/Providers/KrakenExchangeRateProvider.cs +++ b/BTCPayServer.Rating/Providers/KrakenExchangeRateProvider.cs @@ -90,10 +90,10 @@ namespace BTCPayServer.Services.Rates public async Task GetRatesAsync(CancellationToken cancellationToken) { var result = new ExchangeRates(); - var symbols = await GetSymbolsAsync(); + var symbols = await GetSymbolsAsync(cancellationToken); var normalizedPairsList = symbols.Where(s => !notFoundSymbols.ContainsKey(s)).Select(s => _Helper.NormalizeSymbol(s)).ToList(); var csvPairsList = string.Join(",", normalizedPairsList); - JToken apiTickers = await MakeJsonRequestAsync("/0/public/Ticker", null, new Dictionary { { "pair", csvPairsList } }); + JToken apiTickers = await MakeJsonRequestAsync("/0/public/Ticker", null, new Dictionary { { "pair", csvPairsList } }, cancellationToken: cancellationToken); var tickers = new List>(); foreach (string symbol in symbols) { @@ -151,7 +151,7 @@ namespace BTCPayServer.Services.Rates }; } - private async Task GetSymbolsAsync() + private async Task GetSymbolsAsync(CancellationToken cancellationToken) { if (_LastSymbolUpdate != null && DateTimeOffset.UtcNow - _LastSymbolUpdate.Value < TimeSpan.FromDays(0.5)) { @@ -159,7 +159,7 @@ namespace BTCPayServer.Services.Rates } else { - JToken json = await MakeJsonRequestAsync("/0/public/AssetPairs"); + JToken json = await MakeJsonRequestAsync("/0/public/AssetPairs", cancellationToken: cancellationToken); var symbols = (from prop in json.Children() where !prop.Name.Contains(".d", StringComparison.OrdinalIgnoreCase) select prop.Name).ToArray(); _Symbols = symbols; _LastSymbolUpdate = DateTimeOffset.UtcNow; @@ -167,7 +167,7 @@ namespace BTCPayServer.Services.Rates } } - private async Task MakeJsonRequestAsync(string url, string baseUrl = null, Dictionary payload = null, string requestMethod = null, CancellationToken cancellationToken = default) + private async Task MakeJsonRequestAsync(string url, string baseUrl = null, Dictionary payload = null, string requestMethod = null, CancellationToken cancellationToken) { StringBuilder sb = new StringBuilder(); sb.Append("https://api.kraken.com");