diff --git a/ts/receiver/cache.ts b/ts/receiver/cache.ts index d4ecb174f..45264d404 100644 --- a/ts/receiver/cache.ts +++ b/ts/receiver/cache.ts @@ -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 diff --git a/ts/receiver/contentMessage.ts b/ts/receiver/contentMessage.ts index 7735ff130..1b87af67d 100644 --- a/ts/receiver/contentMessage.ts +++ b/ts/receiver/contentMessage.ts @@ -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; } }