Commit 6dceeba7 authored by Clint Mourlevat's avatar Clint Mourlevat

Fixing issue for the timer

parent 7e453c2f
...@@ -30,12 +30,12 @@ namespace Stratis.Guru.Services ...@@ -30,12 +30,12 @@ namespace Stratis.Guru.Services
updateTimer.Enabled = true; updateTimer.Enabled = true;
updateTimer.Elapsed += async (sender, args) => updateTimer.Elapsed += async (sender, args) =>
{ {
updateTimer.Interval = TimeSpan.FromMinutes(10).TotalMilliseconds;
var coinmarketCapApiClient = new RestClient("https://api.coinmarketcap.com/v2/ticker/1343/"); var coinmarketCapApiClient = new RestClient("https://api.coinmarketcap.com/v2/ticker/1343/");
var coinmarketCapApiRequest = new RestRequest(Method.GET); var coinmarketCapApiRequest = new RestRequest(Method.GET);
var coinmarketcapApi = coinmarketCapApiClient.Execute(coinmarketCapApiRequest); var coinmarketcapApi = coinmarketCapApiClient.Execute(coinmarketCapApiRequest);
_memoryCache.Set("Coinmarketcap", coinmarketcapApi.Content); _memoryCache.Set("Coinmarketcap", coinmarketcapApi.Content);
Console.WriteLine(DateTime.Now + " - Ticker Updated"); Console.WriteLine(DateTime.Now + " - Ticker Updated");
updateTimer.Interval = TimeSpan.FromMinutes(10).TotalMilliseconds;
await _hubContext.Clients.All.SendAsync("UpdateTicker", cancellationToken); await _hubContext.Clients.All.SendAsync("UpdateTicker", cancellationToken);
}; };
updateTimer.Start(); updateTimer.Start();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment