Skip to content

Commit

Permalink
fix: prevent initial run of wallet recovery
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
sdbondi committed Aug 30, 2021
1 parent 5dc10c2 commit 1ef8234
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions applications/daily_tests/automatic_recovery_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ async function run(options = {}) {
outputStream: logfile,
onData: (data) => {
let successLog = data.match(RECOVERY_COMPLETE_REGEXP);
let recoveredAmount = data.match(RECOVERY_WORTH_REGEXP);
if (successLog && recoveredAmount) {
let recoveredAmount = parseInt(recoveredAmount[1]);
if (recoveredAmount[2] === "T") {
let recoveredAmountMatch = data.match(RECOVERY_WORTH_REGEXP);
if (successLog && recoveredAmountMatch) {
let recoveredAmount = parseInt(recoveredAmountMatch[1]);
if (recoveredAmountMatch[2] === "T") {
// convert to micro tari
recoveredAmount *= 1000000;
}
return {
height: parseInt(height[1]),
recoveredAmount: parseInt(recoveredAmount[1]),
recoveredAmount,
};
}

Expand Down
4 changes: 2 additions & 2 deletions applications/daily_tests/cron_jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 1ef8234

Please sign in to comment.