重构六位定时任务服务

This commit is contained in:
whyour
2023-04-08 17:07:06 +08:00
parent 59c26d90d3
commit 6fb39ce835
13 changed files with 854 additions and 68 deletions
+4 -1
View File
@@ -138,7 +138,10 @@ export default class ScheduleService {
async cancelCronTask({ id = 0, name }: ScheduleTaskType) {
const _id = this.formatId(id);
this.logger.info('[取消定时任务],任务名:%s', name);
this.scheduleStacks.has(_id) && this.scheduleStacks.get(_id)?.cancel();
if (this.scheduleStacks.has(_id)) {
this.scheduleStacks.get(_id)?.cancel();
this.scheduleStacks.delete(_id);
}
}
async createIntervalTask(