diff --git a/app/api/coreApi.js b/app/api/coreApi.js index 3550d7b..ff0789a 100644 --- a/app/api/coreApi.js +++ b/app/api/coreApi.js @@ -126,13 +126,7 @@ function tryCacheThenRpcApi(cache, cacheKey, cacheMaxAge, rpcApiFunction, cacheC return new Promise(function(resolve, reject) { var cacheResult = null; - cache.get(cacheKey).then(function(result) { - cacheResult = result; - - }).catch(function(err) { - console.log(`Error nds9fc2eg621tf3: key=${cacheKey}, err=${err}`); - - }).finally(function() { + var finallyFunc = function() { if (cacheResult != null) { resolve(cacheResult); @@ -148,6 +142,17 @@ function tryCacheThenRpcApi(cache, cacheKey, cacheMaxAge, rpcApiFunction, cacheC reject(err); }); } + }; + + cache.get(cacheKey).then(function(result) { + cacheResult = result; + + finallyFunc(); + + }).catch(function(err) { + console.log(`Error nds9fc2eg621tf3: key=${cacheKey}, err=${err}`); + + finallyFunc(); }); }); } diff --git a/app/api/electrumApi.js b/app/api/electrumApi.js index 38ba0ec..f032f4d 100644 --- a/app/api/electrumApi.js +++ b/app/api/electrumApi.js @@ -38,12 +38,14 @@ function reconnectToServers() { console.log("Reconnecting ElectrumX sockets..."); - connectToServers().catch(function(err) { - console.log("Error 317fh29y7fg3333: " + err); - - }).finally(function() { + connectToServers().then(function() { console.log("Done reconnecting ElectrumX sockets."); + resolve(); + + }).catch(function(err) { + console.log("Error 317fh29y7fg3333: " + err); + resolve(); }); }); diff --git a/routes/baseActionsRouter.js b/routes/baseActionsRouter.js index 096de88..62038de 100644 --- a/routes/baseActionsRouter.js +++ b/routes/baseActionsRouter.js @@ -787,10 +787,14 @@ router.get("/address/:address", function(req, res, next) { }); })); - Promise.all(promises).catch(function(err) { + Promise.all(promises).then(function() { + res.render("address"); + + next(); + + }).catch(function(err) { console.log("Error 32197rgh327g2: " + err + ", error json: " + JSON.stringify(err)); - }).finally(function() { res.render("address"); next();