mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
修复任务详情日志列表卡顿
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ export class Crontab {
|
||||
|
||||
constructor(options: Crontab) {
|
||||
this.name = options.name;
|
||||
this.command = options.command;
|
||||
this.command = options.command.trim();
|
||||
this.schedule = options.schedule;
|
||||
this.saved = options.saved;
|
||||
this.id = options.id;
|
||||
|
||||
@@ -17,7 +17,7 @@ const addCron = (
|
||||
scheduleStacks.get(id)?.cancel();
|
||||
}
|
||||
|
||||
let cmdStr = command;
|
||||
let cmdStr = command.trim();
|
||||
if (!cmdStr.startsWith(TASK_PREFIX) && !cmdStr.startsWith(QL_PREFIX)) {
|
||||
cmdStr = `${TASK_PREFIX}${cmdStr}`;
|
||||
}
|
||||
@@ -25,8 +25,12 @@ const addCron = (
|
||||
scheduleStacks.set(
|
||||
id,
|
||||
nodeSchedule.scheduleJob(id, schedule, async () => {
|
||||
Logger.silly(`当前时间: ${dayjs().format('YYYY-MM-DD HH:mm:ss')},运行命令: ${cmdStr}`);
|
||||
runCron(`ID=${id} ${cmdStr}`)
|
||||
Logger.info(
|
||||
`当前时间: ${dayjs().format(
|
||||
'YYYY-MM-DD HH:mm:ss',
|
||||
)},运行命令: ${cmdStr}`,
|
||||
);
|
||||
runCron(`ID=${id} ${cmdStr}`);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -507,13 +507,14 @@ export default class CronService {
|
||||
}
|
||||
|
||||
private make_command(tab: Crontab) {
|
||||
let command = tab.command.trim();
|
||||
if (
|
||||
!tab.command.startsWith(TASK_PREFIX) &&
|
||||
!tab.command.startsWith(QL_PREFIX)
|
||||
!command.startsWith(TASK_PREFIX) &&
|
||||
!command.startsWith(QL_PREFIX)
|
||||
) {
|
||||
tab.command = `${TASK_PREFIX}${tab.command}`;
|
||||
command = `${TASK_PREFIX}${tab.command}`;
|
||||
}
|
||||
const crontab_job_string = `ID=${tab.id} ${tab.command}`;
|
||||
const crontab_job_string = `ID=${tab.id} ${command}`;
|
||||
return crontab_job_string;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ class TaskLimit {
|
||||
this.cpuLimit = pLimit(limit);
|
||||
return;
|
||||
}
|
||||
await AuthModel.sync();
|
||||
const doc = await AuthModel.findOne({ where: { type: AuthDataType.systemConfig } });
|
||||
if (doc?.info?.cronConcurrency) {
|
||||
this.cpuLimit = pLimit(doc?.info?.cronConcurrency);
|
||||
|
||||
Reference in New Issue
Block a user