Browse Source

Merge pull request #559 from colinin/5.2.0

fix: fix throw Quartz.SchedulerException: Repeat Interval cannot be z…
pull/580/head
yx lin 4 years ago
committed by GitHub
parent
commit
b602180a97
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Quartz/LINGYUN/Abp/BackgroundTasks/Quartz/QuartzJobExecutorProvider.cs

17
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Quartz/LINGYUN/Abp/BackgroundTasks/Quartz/QuartzJobExecutorProvider.cs

@ -122,10 +122,19 @@ public class QuartzJobExecutorProvider : IQuartzJobExecutorProvider, ISingletonD
.StartAt(Clock.Now.AddSeconds(job.Interval))
.EndAt(job.EndTime)
.ForJob(KeyBuilder.CreateJobKey(job))
.WithPriority((int)job.Priority)
.WithSimpleSchedule(x =>
x.WithIntervalInSeconds(job.Interval)
.WithRepeatCount(maxCount));
.WithPriority((int)job.Priority);
// Quartz约定. 重复间隔不能为0
// fix throw Quartz.SchedulerException: Repeat Interval cannot be zero.
var scheduleBuilder = SimpleScheduleBuilder.Create();
scheduleBuilder.WithRepeatCount(maxCount);
if (job.Interval > 0)
{
scheduleBuilder.WithIntervalInSeconds(job.Interval);
}
triggerBuilder.WithSchedule(scheduleBuilder);
break;
}

Loading…
Cancel
Save