From bb4bd51e75a4f0dc43bf29d4a7af5443afb1f464 Mon Sep 17 00:00:00 2001 From: mohamad khawam Date: Tue, 5 Mar 2024 00:15:35 -0500 Subject: [PATCH] reset db on unable to read privatekey --- src/db/db.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/db/db.ts b/src/db/db.ts index af487a6..f4e4e91 100644 --- a/src/db/db.ts +++ b/src/db/db.ts @@ -177,11 +177,12 @@ class DataBase { process.exit(1); } if (trials <= 10) { + console.log("new Level"); this.backupDB = new Level(this.backupDir); this.db = new Level(this.filePath); } try { - await delay(1000); + await delay(500); this.checkAndCreateDB(); this.initAndCreateBackUpDB(); try { @@ -214,8 +215,9 @@ class DataBase { } this.log.log((error as string) + " Unable to init DB"); await delay(500); + await this._resetDB(); trials = trials - 1; - await this.initDB(trials); + return await this.initDB(trials); } }