From 9ddf6986e491ac92ecc55d4c7db2a630f03d4efc Mon Sep 17 00:00:00 2001 From: whyour Date: Mon, 29 Nov 2021 21:49:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=80=E5=90=8E=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E9=95=BF=E8=A2=AB=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/cron.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/back/services/cron.ts b/back/services/cron.ts index f51943c8..b2f76d5b 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -93,17 +93,21 @@ export default class CronService { last_running_time: number; last_execution_time: number; }) { + const options: any = { + status, + pid, + log_path, + last_execution_time, + }; + if (last_running_time > 0) { + options.last_running_time = last_running_time; + } + return new Promise((resolve) => { this.cronDb.update( { _id: { $in: ids } }, { - $set: { - status, - pid, - log_path, - last_running_time, - last_execution_time, - }, + $set: options, }, { multi: true, returnUpdatedDocs: true }, (err) => {