public Task StartAsync(CancellationToken cancellationToken) { try { MySettings.DefaultSettings(); _timer.Interval = MySettings.SampleRate * 1000; _timer.Elapsed += TimerMethod; _timer.AutoReset = false; _timer.Start(); var json = GetJsonData.GetJson(MySettings.nodepoolsurl, MySettings.token); var Pools = json["data"].ToObject <List <Rancher.NodePool> >(); nodePools = Pools.Where(np => np.worker).ToList(); if (nodePools.Count == 0) { Console.WriteLine("Node pools empty!"); return(StopAsync(cancellationToken)); } Console.WriteLine($"[{nameof(NodeAutoScaler)}] has been started....."); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(Task.CompletedTask); }