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
This commit is contained in:
Audric Ackermann 2021-02-10 18:08:31 +11:00
parent 375c5ba1a8
commit ad06b94708
2 changed files with 7 additions and 2 deletions

View File

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

View File

@ -127,7 +127,12 @@ async function decryptForClosedGroup(
keypairRequestManager.markRequestSendFor(groupPubKey, Date.now());
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;
}
}