Fix case where we were performing remote inserts.

This commit is contained in:
Greyson Parrelli 2023-02-10 15:44:18 -05:00
parent a02d2e467b
commit 3f81a94176
2 changed files with 4 additions and 4 deletions

View file

@ -88,8 +88,8 @@ public class StorageForcePushJob extends BaseJob {
StorageKey storageServiceKey = SignalStore.storageService().getOrCreateStorageKey();
SignalServiceAccountManager accountManager = ApplicationDependencies.getSignalServiceAccountManager();
RecipientTable recipientTable = SignalDatabase.recipients();
UnknownStorageIdTable storageIdDatabase = SignalDatabase.unknownStorageIds();
RecipientTable recipientTable = SignalDatabase.recipients();
UnknownStorageIdTable storageIdTable = SignalDatabase.unknownStorageIds();
long currentVersion = accountManager.getStorageManifestVersion();
Map<RecipientId, StorageId> oldContactStorageIds = recipientTable.getContactStorageSyncIdsMap();
@ -134,7 +134,7 @@ public class StorageForcePushJob extends BaseJob {
SignalStore.storageService().setManifest(manifest);
recipientTable.applyStorageIdUpdates(newContactStorageIds);
recipientTable.applyStorageIdUpdates(Collections.singletonMap(Recipient.self().getId(), accountRecord.getId()));
storageIdDatabase.deleteAll();
storageIdTable.deleteAll();
}
@Override

View file

@ -331,7 +331,7 @@ public class StorageSyncJob extends BaseJob {
Log.i(TAG, "Removed " + removedUnregistered + " recipients from storage service that have been unregistered for longer than 30 days.");
}
List<StorageId> localStorageIds = getAllLocalStorageIds(self);
List<StorageId> localStorageIds = getAllLocalStorageIds(self).stream().filter(it -> !it.isUnknown()).collect(Collectors.toList());
IdDifferenceResult idDifference = StorageSyncHelper.findIdDifference(remoteManifest.getStorageIds(), localStorageIds);
List<SignalStorageRecord> remoteInserts = buildLocalStorageRecords(context, self, idDifference.getLocalOnlyIds());
List<byte[]> remoteDeletes = Stream.of(idDifference.getRemoteOnlyIds()).map(StorageId::getRaw).toList();