mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 09:08:02 +01:00
Update AccountsManager mismatch comparison
This commit is contained in:
@@ -665,11 +665,6 @@ public class AccountsManager {
|
||||
dynamoAccount.getMasterDevice().get().getSignedPreKey())) {
|
||||
return Optional.of("masterDeviceSignedPreKey");
|
||||
}
|
||||
|
||||
if (!Objects.equals(databaseAccount.getMasterDevice().get().getPushTimestamp(),
|
||||
dynamoAccount.getMasterDevice().get().getPushTimestamp())) {
|
||||
return Optional.of("masterDevicePushTimestamp");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -681,6 +676,15 @@ public class AccountsManager {
|
||||
return Optional.of("version");
|
||||
}
|
||||
|
||||
if (databaseAccount.getMasterDevice().isPresent() && dynamoAccount.getMasterDevice().isPresent()) {
|
||||
if (Math.abs(databaseAccount.getMasterDevice().get().getPushTimestamp() -
|
||||
dynamoAccount.getMasterDevice().get().getPushTimestamp()) > 60 * 1_000L) {
|
||||
// These are generally few milliseconds off, because the setter uses System.currentTimeMillis() internally,
|
||||
// but we can be more relaxed
|
||||
return Optional.of("masterDevicePushTimestamp");
|
||||
}
|
||||
}
|
||||
|
||||
if (!serializedEquals(databaseAccount, dynamoAccount)) {
|
||||
return Optional.of("serialization");
|
||||
}
|
||||
@@ -756,6 +760,9 @@ public class AccountsManager {
|
||||
@JsonIgnore
|
||||
private long lastSeen;
|
||||
|
||||
@JsonIgnore
|
||||
private long pushTimestamp;
|
||||
|
||||
}
|
||||
|
||||
private boolean serializedEquals(final Object database, final Object dynamo) throws JsonProcessingException {
|
||||
|
||||
Reference in New Issue
Block a user