@whyour/qinglong 2.17.10-rc.1 → 2.17.10-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -370,7 +370,7 @@ let CronService = class CronService {
|
|
|
370
370
|
resolve(params);
|
|
371
371
|
return;
|
|
372
372
|
}
|
|
373
|
-
this.logger.info(`[panel][开始执行任务]
|
|
373
|
+
this.logger.info(`[panel][开始执行任务] 参数: ${JSON.stringify(params)}`);
|
|
374
374
|
let { id, command, log_path } = cron;
|
|
375
375
|
const uniqPath = await (0, util_1.getUniqPath)(command, `${id}`);
|
|
376
376
|
const logTime = (0, dayjs_1.default)().format('YYYY-MM-DD-HH-mm-ss-SSS');
|
|
@@ -386,12 +386,15 @@ let CronService = class CronService {
|
|
|
386
386
|
await promises_1.default.appendFile(absolutePath, data.toString());
|
|
387
387
|
});
|
|
388
388
|
cp.stderr.on('data', async (data) => {
|
|
389
|
+
this.logger.info('[panel][执行任务失败] 命令: %s, 错误信息: %j', command, data.toString());
|
|
389
390
|
await promises_1.default.appendFile(absolutePath, data.toString());
|
|
390
391
|
});
|
|
391
392
|
cp.on('error', async (err) => {
|
|
393
|
+
this.logger.error('[panel][创建任务失败] 命令: %s, 错误信息: %j', command, err);
|
|
392
394
|
await promises_1.default.appendFile(absolutePath, JSON.stringify(err));
|
|
393
395
|
});
|
|
394
396
|
cp.on('exit', async (code) => {
|
|
397
|
+
this.logger.info('[panel][执行任务结束] 参数: %s, 退出码: %j', JSON.stringify(params), code);
|
|
395
398
|
await cron_1.CrontabModel.update({ status: cron_1.CrontabStatus.idle, pid: undefined }, { where: { id } });
|
|
396
399
|
resolve(Object.assign(Object.assign({}, params), { pid: cp.pid, code }));
|
|
397
400
|
});
|
|
@@ -49,7 +49,7 @@ let ScheduleService = class ScheduleService {
|
|
|
49
49
|
return pLimit_1.default[this.taskLimitMap[runOrigin]](others, () => {
|
|
50
50
|
return new Promise(async (resolve, reject) => {
|
|
51
51
|
var _a, _b, _c;
|
|
52
|
-
this.logger.info(`[panel][开始执行任务]
|
|
52
|
+
this.logger.info(`[panel][开始执行任务] 参数: ${JSON.stringify(Object.assign(Object.assign({}, others), { command }))}`);
|
|
53
53
|
try {
|
|
54
54
|
const startTime = (0, dayjs_1.default)();
|
|
55
55
|
await ((_a = callbacks.onBefore) === null || _a === void 0 ? void 0 : _a.call(callbacks, startTime));
|
|
@@ -72,6 +72,7 @@ let ScheduleService = class ScheduleService {
|
|
|
72
72
|
});
|
|
73
73
|
cp.on('exit', async (code) => {
|
|
74
74
|
var _a;
|
|
75
|
+
this.logger.info('[panel][执行任务结束] 参数: %s, 退出码: %j', JSON.stringify(Object.assign(Object.assign({}, others), { command })), code);
|
|
75
76
|
const endTime = (0, dayjs_1.default)();
|
|
76
77
|
await ((_a = callbacks.onEnd) === null || _a === void 0 ? void 0 : _a.call(callbacks, cp, endTime, endTime.diff(startTime, 'seconds')));
|
|
77
78
|
resolve(Object.assign(Object.assign({}, others), { pid: cp.pid, code }));
|
|
@@ -126,7 +127,7 @@ let ScheduleService = class ScheduleService {
|
|
|
126
127
|
runOrigin,
|
|
127
128
|
});
|
|
128
129
|
}, (err) => {
|
|
129
|
-
this.logger.error('[执行任务失败] 命令: %s, 错误信息: %j', command, err);
|
|
130
|
+
this.logger.error('[panel][执行任务失败] 命令: %s, 错误信息: %j', command, err);
|
|
130
131
|
});
|
|
131
132
|
const job = new toad_scheduler_1.LongIntervalJob(Object.assign({ runImmediately: false }, schedule), task, _id);
|
|
132
133
|
this.intervalSchedule.addIntervalJob(job);
|
|
@@ -141,7 +142,7 @@ let ScheduleService = class ScheduleService {
|
|
|
141
142
|
}
|
|
142
143
|
async cancelIntervalTask({ id = 0, name }) {
|
|
143
144
|
const _id = this.formatId(id);
|
|
144
|
-
this.logger.info('[取消interval任务], 任务ID: %s, 任务名: %s', _id, name);
|
|
145
|
+
this.logger.info('[panel][取消interval任务], 任务ID: %s, 任务名: %s', _id, name);
|
|
145
146
|
this.intervalSchedule.removeById(_id);
|
|
146
147
|
}
|
|
147
148
|
formatId(id) {
|
|
@@ -20,6 +20,7 @@ function runCron(cmd, cron) {
|
|
|
20
20
|
});
|
|
21
21
|
cp.on('exit', async (code) => {
|
|
22
22
|
pLimit_1.default.removeQueuedCron(cron.id);
|
|
23
|
+
logger_1.default.info('[schedule][执行任务结束] 参数: %s, 退出码: %j', JSON.stringify(Object.assign(Object.assign({}, cron), { command: cmd })), code);
|
|
23
24
|
resolve(Object.assign(Object.assign({}, cron), { command: cmd, pid: cp.pid, code }));
|
|
24
25
|
});
|
|
25
26
|
});
|