修复修改任务状态可能报错

This commit is contained in:
whyour
2024-06-28 20:41:05 +08:00
parent b60cda66bb
commit 90fe63211d
3 changed files with 12 additions and 2 deletions
+7 -1
View File
@@ -114,7 +114,13 @@ export default class CronService {
}
for (const id of ids) {
const cron = await this.getDb({ id });
let cron;
try {
cron = await this.getDb({ id });
} catch (err) {}
if (!cron) {
continue;
}
if (status === CrontabStatus.idle && log_path !== cron.log_path) {
options = omit(options, ['status', 'log_path', 'pid']);
}
+2 -1
View File
@@ -1,6 +1,7 @@
import { Service, Inject } from 'typedi';
import winston from 'winston';
import {
createFile,
createRandomString,
fileExist,
getNetIp,
@@ -266,7 +267,7 @@ export default class UserService {
public async getUserInfo(): Promise<any> {
const authFileExist = await fileExist(config.authConfigFile);
if (!authFileExist) {
await fs.writeFile(
await createFile(
config.authConfigFile,
JSON.stringify({
username: 'admin',