do not drop a message which was not decrypted for a medium group

Instead, trigger a request to the group to get the encryption keypair.
We will try to process those messages on an app restart
pull/1498/head
Audric Ackermann 4 years ago
parent 375c5ba1a8
commit ad06b94708

@ -54,7 +54,7 @@ export async function getAllFromCache() {
const attempts = _.toNumber(item.attempts || 0) + 1; const attempts = _.toNumber(item.attempts || 0) + 1;
try { try {
if (attempts >= 3) { if (attempts >= 10) {
window.log.warn( window.log.warn(
'getAllFromCache final attempt for envelope', 'getAllFromCache final attempt for envelope',
item.id item.id

@ -127,7 +127,12 @@ async function decryptForClosedGroup(
keypairRequestManager.markRequestSendFor(groupPubKey, Date.now()); keypairRequestManager.markRequestSendFor(groupPubKey, Date.now());
await requestEncryptionKeyPair(groupPubKey); await requestEncryptionKeyPair(groupPubKey);
} }
await removeFromCache(envelope); throw new Error(
`Waiting for an encryption keypair to be received for group ${groupPubKey.key}`
);
// do not remove it from the cache yet. We will try to decrypt it once we get the encryption keypair
// TODO drop it if after some time we still don't get to decrypt it
// await removeFromCache(envelope);
return null; return null;
} }
} }

Loading…
Cancel
Save