You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
1.2 KiB

2 years ago
  1. namespace WebApp
  2. {
  3. public static class TaskScheduler
  4. {
  5. public static async System.Threading.Tasks.Task StartAsync()
  6. {
  7. await new Jobs.Outlook.RunSyn().Run();
  8. //// 每隔一段时间执行任务
  9. //IScheduler sched;
  10. //ISchedulerFactory sf = new StdSchedulerFactory();
  11. //sched = sf.GetScheduler();
  12. //// IndexJob为实现了IJob接口的类
  13. //JobDetail job = new JobDetail("job1", "group1", typeof(BuildStasticsJob));
  14. //// 5秒后开始第一次运行
  15. //DateTime ts = TriggerUtils.GetNextGivenSecondDate(null, 5);
  16. //// 每隔1小时执行一次
  17. //TimeSpan interval = TimeSpan.FromHours(1);
  18. //// 每若干小时运行一次,小时间隔由appsettings中的IndexIntervalHour参数指定
  19. //Trigger trigger = new SimpleTrigger("trigger1", "group1", "job1", "group1", ts, null,
  20. // SimpleTrigger.RepeatIndefinitely, interval);
  21. //sched.AddJob(job, true);
  22. //sched.ScheduleJob(trigger);
  23. //sched.Start();
  24. }
  25. }
  26. }