添加最后运行时间和运行时长

This commit is contained in:
hanhh
2021-09-23 13:42:32 +08:00
parent eac4e5e66f
commit af420942c4
6 changed files with 124 additions and 14 deletions
+22 -4
View File
@@ -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[]) {