Do more to ensure that we have the latest self in StorageSyncJob.
This commit is contained in:
parent
a697b6c3d4
commit
ed3c5ab479
1 changed files with 10 additions and 6 deletions
|
@ -216,14 +216,14 @@ public class StorageSyncJob extends BaseJob {
|
|||
|
||||
stopwatch.split("remote-manifest");
|
||||
|
||||
Recipient self = Recipient.self().fresh();
|
||||
Recipient self = freshSelf();
|
||||
boolean needsMultiDeviceSync = false;
|
||||
boolean needsForcePush = false;
|
||||
|
||||
if (self.getStorageServiceId() == null) {
|
||||
Log.w(TAG, "No storageId for self. Generating.");
|
||||
DatabaseFactory.getRecipientDatabase(context).updateStorageId(self.getId(), StorageSyncHelper.generateKey());
|
||||
self = Recipient.self().fresh();
|
||||
self = freshSelf();
|
||||
}
|
||||
|
||||
Log.i(TAG, "Our version: " + localManifest.getVersion() + ", their version: " + remoteManifest.getVersion());
|
||||
|
@ -276,15 +276,14 @@ public class StorageSyncJob extends BaseJob {
|
|||
|
||||
db.beginTransaction();
|
||||
try {
|
||||
self = Recipient.self().fresh();
|
||||
self = freshSelf();
|
||||
|
||||
new ContactRecordProcessor(context, self).process(remoteContacts, StorageSyncHelper.KEY_GENERATOR);
|
||||
new GroupV1RecordProcessor(context).process(remoteGv1, StorageSyncHelper.KEY_GENERATOR);
|
||||
new GroupV2RecordProcessor(context).process(remoteGv2, StorageSyncHelper.KEY_GENERATOR);
|
||||
self = freshSelf();
|
||||
new AccountRecordProcessor(context, self).process(remoteAccount, StorageSyncHelper.KEY_GENERATOR);
|
||||
|
||||
self = Recipient.self().fresh();
|
||||
|
||||
List<SignalStorageRecord> unknownInserts = remoteUnknown;
|
||||
List<StorageId> unknownDeletes = Stream.of(idDifference.getLocalOnlyIds()).filter(StorageId::isUnknown).toList();
|
||||
|
||||
|
@ -317,7 +316,7 @@ public class StorageSyncJob extends BaseJob {
|
|||
|
||||
db.beginTransaction();
|
||||
try {
|
||||
self = Recipient.self().fresh();
|
||||
self = freshSelf();
|
||||
|
||||
List<StorageId> localStorageIds = getAllLocalStorageIds(context, self);
|
||||
IdDifferenceResult idDifference = StorageSyncHelper.findIdDifference(remoteManifest.getStorageIds(), localStorageIds);
|
||||
|
@ -420,6 +419,11 @@ public class StorageSyncJob extends BaseJob {
|
|||
return records;
|
||||
}
|
||||
|
||||
private static @NonNull Recipient freshSelf() {
|
||||
Recipient.self().live().refresh();
|
||||
return Recipient.self();
|
||||
}
|
||||
|
||||
private static final class MissingGv2MasterKeyError extends Error {}
|
||||
|
||||
private static final class MissingRecipientModelError extends Error {
|
||||
|
|
Loading…
Add table
Reference in a new issue