修改日志名称格式

This commit is contained in:
whyour
2023-02-17 22:49:06 +08:00
parent 9bc7ca4094
commit 403ab7f0f0
6 changed files with 14 additions and 17 deletions
+4 -2
View File
@@ -21,6 +21,7 @@ export default async () => {
name: '生成token',
command: tokenCommand,
};
await scheduleService.cancelIntervalTask(cron);
scheduleService.createIntervalTask(cron, {
days: 28,
});
@@ -28,12 +29,13 @@ export default async () => {
// 运行删除日志任务
const data = await systemService.getLogRemoveFrequency();
if (data && data.info && data.info.frequency) {
const cron = {
const rmlogCron = {
id: data.id,
name: '删除日志',
command: `ql rmlog ${data.info.frequency}`,
};
scheduleService.createIntervalTask(cron, {
await scheduleService.cancelIntervalTask(rmlogCron);
scheduleService.createIntervalTask(rmlogCron, {
days: data.info.frequency,
});
}
+5 -7
View File
@@ -5,8 +5,8 @@ import { ChildProcessWithoutNullStreams, exec, spawn } from 'child_process';
import {
ToadScheduler,
LongIntervalJob,
AsyncTask,
SimpleIntervalSchedule,
Task,
} from 'toad-scheduler';
import dayjs from 'dayjs';
@@ -154,12 +154,10 @@ export default class ScheduleService {
name,
command,
);
const task = new AsyncTask(
const task = new Task(
name,
async () => {
return new Promise(async (resolve, reject) => {
await this.runTask(command, callbacks);
});
() => {
this.runTask(command, callbacks);
},
(err) => {
this.logger.error(
@@ -180,7 +178,7 @@ export default class ScheduleService {
this.intervalSchedule.addIntervalJob(job);
if (runImmediately) {
await this.runTask(command, callbacks);
this.runTask(command, callbacks);
}
}