修复定时任务 real_time 参数,升级 protobufjs

This commit is contained in:
whyour
2024-06-02 11:08:35 +08:00
parent 70f2bef5d2
commit 07541569c5
5 changed files with 28 additions and 28 deletions
+8 -3
View File
@@ -435,7 +435,10 @@ export default class CronService {
const logPath = `${uniqPath}/${logTime}.log`;
const absolutePath = path.resolve(config.logPath, `${logPath}`);
const cp = spawn(
`real_log_path=${logPath} real_time=true no_delay=true ${this.makeCommand(cron)}`,
`real_log_path=${logPath} no_delay=true ${this.makeCommand(
cron,
true
)}`,
{ shell: '/bin/bash' },
);
@@ -526,12 +529,14 @@ export default class CronService {
}
}
private makeCommand(tab: Crontab) {
private makeCommand(tab: Crontab, realTime?: boolean) {
let command = tab.command.trim();
if (!command.startsWith(TASK_PREFIX) && !command.startsWith(QL_PREFIX)) {
command = `${TASK_PREFIX}${tab.command}`;
}
let commandVariable = `no_tee=true ID=${tab.id} `;
let commandVariable = `real_time=${Boolean(realTime)} no_tee=true ID=${
tab.id
} `;
if (tab.task_before) {
commandVariable += `task_before='${tab.task_before
.replace(/'/g, "'\\''")