Re-apply merge changes

This commit is contained in:
yflory 2024-11-22 14:07:14 +01:00
parent 94c8fcdb9c
commit eb35ea6da5
2 changed files with 8 additions and 1 deletions

View File

@ -2309,6 +2309,12 @@ const factory = (ApiConfig = {}, Sortify, UserObject, ProxyManager,
if (completed) { return; }
var parsed = parse(msg);
if (parsed[1] !== txid) { console.log('bad txid'); return; }
if (parsed[0] === 'HISTORY_RANGE_ERROR') {
cb({
error: parsed[2]
});
return;
}
if (parsed[0] === 'HISTORY_RANGE_END') {
cb({
messages: msgs,

View File

@ -376,7 +376,8 @@ const factory = (Crypto, Hash, Util, Realtime, Messaging,
}
// History cleared while we were offline
// ==> we asked for an invalid last known hash
if (parsed.error && parsed.error === "EINVAL") {
if (parsed.error && (parsed.error === "EINVAL"
|| parsed.error === "EUNKNOWN")) {
setChannelHead(ctx, parsed.channel, '', function () {
getChannelMessagesSince(ctx, channel, {}, {});
});