예제 #1
0
        protected async override Task ExecuteAsync(CancellationToken cancellationToken)
        {
            var pollingFrequency = Math.Max(appOptionsDelegate.CurrentValue.PollingFrequency * 1000, appOptionsDelegate.CurrentValue.StandardTransitionTime);
            await lightManager.Refresh(DateTime.Now);

            lightManager.PrintAll();
            while (!cancellationToken.IsCancellationRequested)
            {
                try
                {
                    await lightScheduler.RunAsync();

                    await Task.Delay(pollingFrequency, cancellationToken);
                }
                catch (Exception e)
                {
                    logger.LogError(e, "RunAsync failed. Retrying...");
                }
            }
        }