Don't send redundant updates to new contacts.

This commit is contained in:
akwizgran
2018-04-24 15:02:13 +01:00
parent 4c5331888a
commit ebaa50b101

View File

@@ -305,14 +305,17 @@ class ClientVersioningManagerImpl implements ClientVersioningManager, Client,
Update oldLocalUpdate = loadUpdate(txn, latest.local.messageId); Update oldLocalUpdate = loadUpdate(txn, latest.local.messageId);
List<ClientState> oldLocalStates = oldLocalUpdate.states; List<ClientState> oldLocalStates = oldLocalUpdate.states;
long oldLocalUpdateVersion = oldLocalUpdate.updateVersion; long oldLocalUpdateVersion = oldLocalUpdate.updateVersion;
// Delete the latest local update // Update the local states if necessary
db.deleteMessage(txn, latest.local.messageId);
db.deleteMessageMetadata(txn, latest.local.messageId);
// Store a new local update
List<ClientState> newLocalStates = List<ClientState> newLocalStates =
updateStatesFromLocalVersions(oldLocalStates, versions); updateStatesFromLocalVersions(oldLocalStates, versions);
storeUpdate(txn, g.getId(), newLocalStates, if (!oldLocalStates.equals(newLocalStates)) {
oldLocalUpdateVersion + 1); // Delete the latest local update
db.deleteMessage(txn, latest.local.messageId);
db.deleteMessageMetadata(txn, latest.local.messageId);
// Store a new local update
storeUpdate(txn, g.getId(), newLocalStates,
oldLocalUpdateVersion + 1);
}
// Load and parse the latest remote update, if any // Load and parse the latest remote update, if any
List<ClientState> remoteStates; List<ClientState> remoteStates;
if (latest.remote == null) remoteStates = emptyList(); if (latest.remote == null) remoteStates = emptyList();