mirror of https://github.com/xwiki-labs/cryptpad
Fix deprecated cache issue
This commit is contained in:
parent
9a6455759f
commit
d39d64626d
|
@ -437,8 +437,13 @@ const getHistoryOffset = (Env, channelName, lastKnownHash, _cb) => {
|
|||
// check if the "hash" the client is requesting exists in the index
|
||||
const lkh = index.offsetByHash[lastKnownHash];
|
||||
|
||||
// Hash too old or no longer exists, empty cache
|
||||
// lastKnownHash requested but not found in the index
|
||||
if (lastKnownHash && typeof(lkh) !== "number") {
|
||||
// No checkpoint: may be a non-chainpad channel
|
||||
if (!index.cpIndex.length) {
|
||||
return;
|
||||
}
|
||||
// Hash too old or no longer exists, empty cache
|
||||
waitFor.abort();
|
||||
return void cb(new Error('EUNKNOWN'));
|
||||
}
|
||||
|
@ -469,14 +474,6 @@ const getHistoryOffset = (Env, channelName, lastKnownHash, _cb) => {
|
|||
return void cb(new Error('EUNKNOWN'));
|
||||
}
|
||||
|
||||
// If we asked for a lastKnownHash but didn't find it AND if
|
||||
// this channel has checkpoints, send EUNKNOWN so that the
|
||||
// client can ask for normal history (without lastKnownHash)
|
||||
if (lastKnownHash && !lkh && index.cpIndex.length) {
|
||||
waitFor.abort();
|
||||
return void cb(new Error('EUNKNOWN'));
|
||||
}
|
||||
|
||||
// Otherwise use our lastKnownHash
|
||||
cb(null, lkh);
|
||||
}));
|
||||
|
|
Loading…
Reference in New Issue