Пример #1
0
        public async Task <DResults <VJob> > JobList(string keyword = null, JobStatus?status = null, int page = 1, int size = 10)
        {
            var pagedList = await _contract.PagedListAsync(new JobPagedInputDto
            {
                ProjectId = ProjectId,
                Keyword   = keyword,
                Status    = status,
                Page      = page,
                Size      = size
            });

            //Get Next Time
            await _scheduler.FillJobsTime(pagedList.List);

            return(DResult.Succ(pagedList.MapPagedList <VJob, JobDto>()));
        }
Пример #2
0
        private async Task StartScheduler()
        {
            var props = new NameValueCollection
            {
                { "quartz.serializer.type", "binary" }
            };
            var factory = new StdSchedulerFactory(props);

            _scheduler = await factory.GetScheduler();

            var jobs = await _jobContract.PagedListAsync(new JobPagedInputDto { Status = JobStatus.Enabled, Size = 1000 });

            foreach (var dto in jobs.List)
            {
                if (dto.Status != JobStatus.Enabled)
                {
                    continue;
                }
                await RunJob(dto);
            }

            await _scheduler.Start();
        }