Two small changes

* Signed prekey rotation: better logging, let => const

* Ensure that we remove sync messages from cache
This commit is contained in:
Scott Nonnenberg 2019-07-19 06:35:04 -07:00 committed by Ken Powers
parent 5e6d5937f7
commit df74103335
2 changed files with 6 additions and 4 deletions

View file

@ -1467,10 +1467,12 @@
window.log.warn(
`onSentMessage: Received update transcript, but no existing entry for message ${message.idForLogging()}. Dropping.`
);
event.confirm();
} else if (existing) {
window.log.warn(
`onSentMessage: Received duplicate transcript for message ${message.idForLogging()}, but it was not an update transcript. Dropping.`
);
event.confirm();
} else {
await ConversationController.getOrCreateAndWait(
messageDescriptor.id,

View file

@ -339,7 +339,7 @@
return store.loadSignedPreKeys().then(allKeys => {
allKeys.sort((a, b) => (a.created_at || 0) - (b.created_at || 0));
allKeys.reverse(); // we want the most recent first
let confirmed = allKeys.filter(key => key.confirmed);
const confirmed = allKeys.filter(key => key.confirmed);
const unconfirmed = allKeys.filter(key => !key.confirmed);
const recent = allKeys[0] ? allKeys[0].keyId : 'none';
@ -357,7 +357,7 @@
let confirmedCount = confirmed.length;
// Keep MINIMUM_KEYS confirmed keys, then drop if older than a week
confirmed = confirmed.forEach((key, index) => {
confirmed.forEach((key, index) => {
if (index < MINIMUM_KEYS) {
return;
}
@ -369,7 +369,7 @@
'Removing confirmed signed prekey:',
key.keyId,
'with timestamp:',
createdAt
new Date(createdAt).toJSON()
);
store.removeSignedPreKey(key.keyId);
confirmedCount -= 1;
@ -392,7 +392,7 @@
'Removing unconfirmed signed prekey:',
key.keyId,
'with timestamp:',
createdAt
new Date(createdAt).toJSON()
);
store.removeSignedPreKey(key.keyId);
}