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);
List<ClientState> oldLocalStates = oldLocalUpdate.states;
long oldLocalUpdateVersion = oldLocalUpdate.updateVersion;
// Delete the latest local update
db.deleteMessage(txn, latest.local.messageId);
db.deleteMessageMetadata(txn, latest.local.messageId);
// Store a new local update
// Update the local states if necessary
List<ClientState> newLocalStates =
updateStatesFromLocalVersions(oldLocalStates, versions);
storeUpdate(txn, g.getId(), newLocalStates,
oldLocalUpdateVersion + 1);
if (!oldLocalStates.equals(newLocalStates)) {
// 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
List<ClientState> remoteStates;
if (latest.remote == null) remoteStates = emptyList();