From 0899606fcecbb63f6df2673a6ba1c1feec24a487 Mon Sep 17 00:00:00 2001 From: Stanimal Date: Mon, 30 Aug 2021 09:35:35 +0400 Subject: [PATCH] fix: prevent initial run of wallet recovery When running cron, the two walet receovery tests would run immediately and not be awaited (Promises are eager in js) - Fix " ReferenceError: Cannot access recoveredAmount before initialization" --- applications/daily_tests/automatic_recovery_test.js | 6 +++--- applications/daily_tests/cron_jobs.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/applications/daily_tests/automatic_recovery_test.js b/applications/daily_tests/automatic_recovery_test.js index a87fa7709b5..0401b2a9c2b 100644 --- a/applications/daily_tests/automatic_recovery_test.js +++ b/applications/daily_tests/automatic_recovery_test.js @@ -84,14 +84,14 @@ async function run(options = {}) { let successLog = data.match(RECOVERY_COMPLETE_REGEXP); let recoveredAmount = data.match(RECOVERY_WORTH_REGEXP); if (successLog && recoveredAmount) { - let recoveredAmount = parseInt(recoveredAmount[1]); + let recoveredAmt = parseInt(recoveredAmount[1]); if (recoveredAmount[2] === "T") { // convert to micro tari - recoveredAmount *= 1000000; + recoveredAmt *= 1000000; } return { height: parseInt(height[1]), - recoveredAmount: parseInt(recoveredAmount[1]), + recoveredAmount: parseInt(recoveredAmt), }; } diff --git a/applications/daily_tests/cron_jobs.js b/applications/daily_tests/cron_jobs.js index f97f1db5e94..7f19e87cc2f 100644 --- a/applications/daily_tests/cron_jobs.js +++ b/applications/daily_tests/cron_jobs.js @@ -121,8 +121,8 @@ ${logLines.join("\n")} } // ------------------------- CRON ------------------------- // -new CronJob("0 7 * * *", runWalletRecoveryTest(1)).start(); -new CronJob("0 7 * * *", runWalletRecoveryTest(5)).start(); +new CronJob("0 7 * * *", () => runWalletRecoveryTest(1)).start(); +new CronJob("30 7 * * *", () => runWalletRecoveryTest(5)).start(); new CronJob("0 6 * * *", () => runBaseNodeSyncTest(SyncType.Archival)).start(); new CronJob("30 6 * * *", () => runBaseNodeSyncTest(SyncType.Pruned)).start();