Browse Source
avoid using promise.finally() which isn't well supported - hopefully fixes #108
fix-133-memory-crash
Dan Janosik
6 years ago
No known key found for this signature in database
GPG Key ID: C6F8CE9FFDB2CED2
3 changed files with
24 additions and
13 deletions
-
app/api/coreApi.js
-
app/api/electrumApi.js
-
routes/baseActionsRouter.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(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
@ -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(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
@ -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(); |
|
|
|