diff --git a/src/crypto/DeviceList.js b/src/crypto/DeviceList.js index e038f923c..b326d975b 100644 --- a/src/crypto/DeviceList.js +++ b/src/crypto/DeviceList.js @@ -150,6 +150,8 @@ export default class DeviceList { if (!this._dirty) return Promise.resolve(false); if (this._savePromise === null) { + // Delay saves for a bit so we can aggregate multiple saves that happen + // in quick succession (eg. when a whole room's devices are marked as known) this._savePromise = Promise.delay(500).then(() => { console.log('Saving device tracking data at token ' + this._syncToken); return this._cryptoStore.doTxn( @@ -172,7 +174,7 @@ export default class DeviceList { } /** - * Gets the current sync token + * Gets the sync token last set with setSyncToken * * @return {string} The sync token */ @@ -181,7 +183,8 @@ export default class DeviceList { } /** - * Sets the current sync token + * Sets the sync token that the app will pass as the 'since' to the /sync + * endpoint next time it syncs. * The sync token must always be set after any changes made as a result of * data in that sync since setting the sync token to a newer one will mean * those changed will not be synced from the server if a new client starts diff --git a/src/crypto/index.js b/src/crypto/index.js index ed7c5a207..f6f442337 100644 --- a/src/crypto/index.js +++ b/src/crypto/index.js @@ -954,6 +954,9 @@ Crypto.prototype._evalDeviceListChanges = async function(deviceLists) { } if (deviceLists.left && Array.isArray(deviceLists.left)) { + // Check we really don't share any rooms with these users + // any more: the server isn't required to give us the + // exact correct set. const e2eUserIds = new Set(this._getE2eUsers()); deviceLists.left.forEach((u) => {