Exemplo n.º 1
0
        protected override void OnRun(CancellationToken ct)
        {
            try
            {
                var newStatsData = StatsService.GetStatsData();

                // if the new data is not equal to the previous data, we updated... otherwise, if the update
                // status is current we should assume the data is current but did not change
                if (!DataContainer.Data.Equals(newStatsData) || newStatsData.Status == "Current")
                {
                    DataContainer.Data = newStatsData;
                    DataContainer.Write();
                }
            }
            catch (Exception)
            {
                DataContainer.Data.LastUpdated = DateTime.UtcNow;
                DataContainer.Write();
                throw;
            }
            finally
            {
                Interval = CalculateInterval(DataContainer.Data.LastUpdated);
            }
        }