mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
添加最后运行时间和运行时长
This commit is contained in:
@@ -270,6 +270,8 @@ export default (app: Router) => {
|
||||
status: Joi.string().required(),
|
||||
pid: Joi.string().optional(),
|
||||
log_path: Joi.string().optional(),
|
||||
last_running_time: Joi.string().optional(),
|
||||
last_execution_time: Joi.string().optional(),
|
||||
}),
|
||||
}),
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
|
||||
+22
-4
@@ -90,16 +90,34 @@ export default class CronService {
|
||||
status,
|
||||
pid,
|
||||
log_path,
|
||||
last_running_time,
|
||||
last_execution_time,
|
||||
}: {
|
||||
ids: string[];
|
||||
status: CrontabStatus;
|
||||
pid: number;
|
||||
log_path: string;
|
||||
last_running_time: string;
|
||||
last_execution_time: string;
|
||||
}) {
|
||||
this.cronDb.update(
|
||||
{ _id: { $in: ids } },
|
||||
{ $set: { status, pid, log_path } },
|
||||
);
|
||||
return new Promise((resolve) => {
|
||||
this.cronDb.update(
|
||||
{ _id: { $in: ids } },
|
||||
{
|
||||
$set: {
|
||||
status,
|
||||
pid,
|
||||
log_path,
|
||||
last_running_time,
|
||||
last_execution_time,
|
||||
},
|
||||
},
|
||||
{ multi: true, returnUpdatedDocs: true },
|
||||
(err) => {
|
||||
resolve(null);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
public async remove(ids: string[]) {
|
||||
|
||||
Reference in New Issue
Block a user