Ejemplo n.º 1
0
        /// <summary>
        /// Updates the queue
        /// </summary>
        private async void PopulateJobsQueue()
        {
            if (Jobs == null)
            {
                Jobs = new List <Schedule>();
            }

            Jobs.Clear();

            foreach (Schedule schedule in await _schedulesMethods.GetSchedulesAsync())
            {
                if (schedule.Job != null)
                {
                    schedule.When = CrontabSchedule.Parse(schedule.Cron).GetNextOccurrence(DateTime.Now);
                    AddJob(schedule);
                }
            }

            Jobs = Jobs.OrderBy(x => x.When).ToList();

            UpdateWakeUpTimer();
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <IEnumerable <Schedule> > > Get()
        {
            List <Schedule> schedules = (await _schedulesMethods.GetSchedulesAsync()).ToList();

            return(Ok(schedules));
        }