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

@@ -305,29 +305,31 @@ async function syncRequest(syncContext, method, uri, body) {
}
}
if (isSyncSetup) {
log.info("Setting up sync to " + SYNC_SERVER + " with timeout " + SYNC_TIMEOUT);
sql.dbReady.then(() => {
if (isSyncSetup) {
log.info("Setting up sync to " + SYNC_SERVER + " with timeout " + SYNC_TIMEOUT);
if (SYNC_PROXY) {
log.info("Sync proxy: " + SYNC_PROXY);
if (SYNC_PROXY) {
log.info("Sync proxy: " + SYNC_PROXY);
}
const syncCertPath = config['Sync']['syncServerCertificate'];
if (syncCertPath) {
log.info('Sync certificate: ' + syncCertPath);
syncServerCertificate = fs.readFileSync(syncCertPath);
}
setInterval(sync, 60000);
// kickoff initial sync immediately
setTimeout(sync, 1000);
}
const syncCertPath = config['Sync']['syncServerCertificate'];
if (syncCertPath) {
log.info('Sync certificate: ' + syncCertPath);
syncServerCertificate = fs.readFileSync(syncCertPath);
else {
log.info("Sync server not configured, sync timer not running.")
}
setInterval(sync, 60000);
// kickoff initial sync immediately
setTimeout(sync, 1000);
}
else {
log.info("Sync server not configured, sync timer not running.")
}
});
module.exports = {
sync,