From 2e240e2819c55acb882be09ca4410e806b9f46a3 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 10 Sep 2020 14:13:28 +0200 Subject: [PATCH] simplify values assignment --- packages/health-check/src/schedule.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/health-check/src/schedule.js b/packages/health-check/src/schedule.js index 7a2c6957..70f4d44b 100644 --- a/packages/health-check/src/schedule.js +++ b/packages/health-check/src/schedule.js @@ -5,18 +5,20 @@ const { verboseChecks } = require("./checks/verbose"); // execute the critical health-check script every 5 minutes const criticalJob = schedule.scheduleJob("*/5 * * * *", async () => { - const entry = { date: new Date().toISOString(), checks: [] }; - - entry.checks = await Promise.all(criticalChecks.map((check) => new Promise(check))); + const entry = { + date: new Date().toISOString(), + checks: await Promise.all(criticalChecks.map((check) => new Promise(check))), + }; db.get("critical").push(entry).write(); }); // execute the verbose health-check script once per hour const verboseJob = schedule.scheduleJob("0 * * * *", async () => { - const entry = { date: new Date().toISOString(), checks: [] }; - - entry.checks = await Promise.all(verboseChecks.map((check) => new Promise(check))); + const entry = { + date: new Date().toISOString(), + checks: await Promise.all(verboseChecks.map((check) => new Promise(check))), + }; db.get("verbose").push(entry).write(); });