Skip to content

Commit

Permalink
Fix case where we were performing remote inserts.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Feb 14, 2023
1 parent a02d2e4 commit 3f81a94
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ protected void onRun() throws IOException, RetryLaterException {

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();
Expand Down Expand Up @@ -134,7 +134,7 @@ protected void onRun() throws IOException, RetryLaterException {
SignalStore.storageService().setManifest(manifest);
recipientTable.applyStorageIdUpdates(newContactStorageIds);
recipientTable.applyStorageIdUpdates(Collections.singletonMap(Recipient.self().getId(), accountRecord.getId()));
storageIdDatabase.deleteAll();
storageIdTable.deleteAll();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ private boolean performSync() throws IOException, RetryLaterException, InvalidKe
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();
Expand Down

0 comments on commit 3f81a94

Please sign in to comment.