MessageReceiver: still queue message, even if respond(200) fails

This commit is contained in:
Scott Nonnenberg 2020-12-03 08:04:50 -08:00 committed by GitHub
parent 673d07e176
commit a4d0c0dfab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 4 deletions

View File

@ -690,19 +690,26 @@ class MessageReceiverInner extends EventTarget {
try {
await window.textsecure.storage.unprocessed.batchAdd(dataArray);
items.forEach(item => {
item.request.respond(200, 'OK');
try {
item.request.respond(200, 'OK');
} catch (error) {
window.log.error(
'cacheAndQueueBatch: Failed to send 200 to server; still queuing envelope'
);
}
this.queueEnvelope(item.envelope);
});
this.maybeScheduleRetryTimeout();
} catch (error) {
items.forEach(item => {
item.request.respond(500, 'Failed to cache message');
});
window.log.error(
'cacheAndQueue error trying to add messages to cache:',
error && error.stack ? error.stack : error
);
items.forEach(item => {
item.request.respond(500, 'Failed to cache message');
});
}
}