Browse Source
Merge pull request #886 from colinin/fix-tasks-with-remove-and-pause
fix(tasks): Stops a job in execution upon deletion
pull/914/head
yx lin
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
0 deletions
-
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Quartz/LINGYUN/Abp/BackgroundTasks/Quartz/QuartzJobScheduler.cs
|
|
|
@ -45,6 +45,9 @@ public class QuartzJobScheduler : IJobScheduler, IJobPublisher, ISingletonDepend |
|
|
|
{ |
|
|
|
await Scheduler.PauseTrigger(trigger.Key, cancellationToken); |
|
|
|
} |
|
|
|
|
|
|
|
// 当暂停作业时, 需要停止已经在执行中的作业
|
|
|
|
await Scheduler.Interrupt(jobKey, cancellationToken); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -114,6 +117,10 @@ public class QuartzJobScheduler : IJobScheduler, IJobPublisher, ISingletonDepend |
|
|
|
{ |
|
|
|
await Scheduler.PauseTrigger(trigger.Key, cancellationToken); |
|
|
|
} |
|
|
|
|
|
|
|
// 当删除作业时, 需要停止已经在执行中的作业
|
|
|
|
await Scheduler.Interrupt(jobKey, cancellationToken); |
|
|
|
|
|
|
|
await Scheduler.DeleteJob(jobKey, cancellationToken); |
|
|
|
|
|
|
|
return !await Scheduler.CheckExists(jobKey, cancellationToken); |
|
|
|
|