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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
13 additions and
4 deletions
-
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; |
|
|
|
} |
|
|
|
|
|
|
|
|