Exemplo n.º 1
0
        protected override async Task ExecuteAsync(CancellationToken cancellationToken)
        {
            while (!cancellationToken.IsCancellationRequested)
            {
                _logger.LogDebug("Scheduled Task Service Running");
                ICollection <ScheduledTask> tasks = _scheduledTaskService.GetScheduledTasks();

                foreach (var task in tasks)
                {
                    if (_scheduledTaskService.IsTimeToRun(task))
                    {
                        await _scheduledTaskService.ExecuteScheduledTask(task);
                    }
                }

                await Task.Delay(3000);
            }
        }