定时任务不主动停止

This commit is contained in:
cool_team 2023-05-08 11:44:42 +08:00
parent edc1383843
commit 63b290ba9f

View File

@ -311,13 +311,13 @@ export class TaskInfoService extends BaseService {
const task = await this.taskInfoEntity.findOneBy({ id: job.id });
const nextTime = await this.getNextRunTime(task.id);
if (task) {
if (task.nextRunTime.getTime() == nextTime.getTime()) {
task.status = 0;
task.nextRunTime = nextTime;
this.taskInfoQueue.removeRepeatableByKey(job.key);
} else {
task.nextRunTime = nextTime;
}
// if (task.nextRunTime.getTime() == nextTime.getTime()) {
// task.status = 0;
// task.nextRunTime = nextTime;
// this.taskInfoQueue.removeRepeatableByKey(job.key);
// } else {
task.nextRunTime = nextTime;
// }
await this.taskInfoEntity.update(task.id, task);
}
}