mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
JS: More fixes for caching.
This commit is contained in:
@@ -592,17 +592,21 @@ Remote.prototype.request_ledger_entry = function (type) {
|
|||||||
request.request_default = request.request;
|
request.request_default = request.request;
|
||||||
|
|
||||||
request.request = function () { // Intercept default request.
|
request.request = function () { // Intercept default request.
|
||||||
|
var bDefault = true;
|
||||||
// .self = Remote
|
// .self = Remote
|
||||||
// this = Request
|
// this = Request
|
||||||
|
|
||||||
// console.log('request_ledger_entry: caught');
|
// console.log('request_ledger_entry: caught');
|
||||||
|
|
||||||
// if (self._ledger_hash) {
|
|
||||||
// // XXX Add caching.
|
if (self._ledger_hash) {
|
||||||
// }
|
// A specific ledger is requested.
|
||||||
|
|
||||||
|
// XXX Add caching.
|
||||||
|
}
|
||||||
// else if (req.ledger_index)
|
// else if (req.ledger_index)
|
||||||
// else if ('ripple_state' === request.type) // YYY Could be cached per ledger.
|
// else if ('ripple_state' === request.type) // YYY Could be cached per ledger.
|
||||||
if ('account_root' === type) {
|
else if ('account_root' === type) {
|
||||||
var cache = self.ledgers.current.account_root;
|
var cache = self.ledgers.current.account_root;
|
||||||
|
|
||||||
if (!cache)
|
if (!cache)
|
||||||
@@ -619,6 +623,8 @@ Remote.prototype.request_ledger_entry = function (type) {
|
|||||||
// YYY Missing lots of fields.
|
// YYY Missing lots of fields.
|
||||||
'node' : node,
|
'node' : node,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
bDefault = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Was not cached.
|
// Was not cached.
|
||||||
@@ -637,12 +643,14 @@ Remote.prototype.request_ledger_entry = function (type) {
|
|||||||
// This type not cached.
|
// This type not cached.
|
||||||
// console.log('request_ledger_entry: non-cached type');
|
// console.log('request_ledger_entry: non-cached type');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bDefault) {
|
||||||
// console.log('request_ledger_entry: invoking');
|
// console.log('request_ledger_entry: invoking');
|
||||||
request.request_default();
|
request.request_default();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
|
|||||||
Reference in New Issue
Block a user