distinguishing between when DB is just connected and when it's ready for queries (validated)

This commit is contained in:
azivner
2017-12-03 19:18:33 -05:00
parent 3a26054619
commit a3f57622ff
5 changed files with 52 additions and 47 deletions

View File

@@ -58,10 +58,12 @@ if (!fs.existsSync(dataDir.BACKUP_DIR)) {
fs.mkdirSync(dataDir.BACKUP_DIR, 0o700);
}
setInterval(regularBackup, 60 * 60 * 1000);
sql.dbReady.then(() => {
setInterval(regularBackup, 60 * 60 * 1000);
// kickoff backup immediately
setTimeout(regularBackup, 1000);
// kickoff backup immediately
setTimeout(regularBackup, 1000);
});
module.exports = {
backupNow