diff --git a/src/modules/task/entity/info.ts b/src/modules/task/entity/info.ts index 2ad152b..a5e66a1 100644 --- a/src/modules/task/entity/info.ts +++ b/src/modules/task/entity/info.ts @@ -54,9 +54,9 @@ export class TaskInfoEntity extends BaseEntity { @Column({ comment: '状态 0-cron 1-时间间隔', default: 0 }) taskType: number; - @Column({ type: 'datetime', nullable: true }) + @Column({ nullable: true }) lastExecuteTime: Date; - @Column({ type: 'datetime', nullable: true }) + @Column({ nullable: true }) lockExpireTime: Date; } diff --git a/src/modules/task/service/local.ts b/src/modules/task/service/local.ts index 39478f9..286bfd4 100644 --- a/src/modules/task/service/local.ts +++ b/src/modules/task/service/local.ts @@ -165,14 +165,16 @@ export class TaskLocalService extends BaseService { this.cronJobs.delete(params.jobId); this.coolEventManager.emit('onLocalTaskStop', params.jobId); } - await this.utils.sleep(1000); - this.createCronJob(params); + setTimeout(async () => { + this.createCronJob(params); + }, 1000); } }); if (params.status === 1) { - await this.utils.sleep(1000); - await this.updateNextRunTime(params.jobId); + setTimeout(async () => { + await this.updateNextRunTime(params.jobId); + }, 1000); } }