Skip to content

Commit

Permalink
Delete storage id of unregistered recipients after remote update
Browse files Browse the repository at this point in the history
  • Loading branch information
AsamK committed Dec 25, 2024
1 parent ac145e6 commit c05b47e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,6 @@ private boolean readDataFromStorage(

logger.debug("Pre-Merge ID Difference :: {}", idDifference);

if (!idDifference.localOnlyIds().isEmpty()) {
final var updated = account.getRecipientStore()
.removeStorageIdsFromLocalOnlyUnregisteredRecipients(connection, idDifference.localOnlyIds());

if (updated > 0) {
logger.warn(
"Found {} records that were deleted remotely but only marked unregistered locally. Removed those from local store.",
updated);
}
}

if (!idDifference.isEmpty()) {
final var remoteOnlyRecords = getSignalStorageRecords(storageKey,
remoteManifest,
Expand All @@ -227,6 +216,18 @@ private boolean readDataFromStorage(
.filter(id -> !KNOWN_TYPES.contains(id.getType()))
.toList();

if (!idDifference.localOnlyIds().isEmpty()) {
final var updated = account.getRecipientStore()
.removeStorageIdsFromLocalOnlyUnregisteredRecipients(connection,
idDifference.localOnlyIds());

if (updated > 0) {
logger.warn(
"Found {} records that were deleted remotely but only marked unregistered locally. Removed those from local store.",
updated);
}
}

logger.debug("Storage ids with unknown type: {} inserts, {} deletes",
unknownInserts.size(),
unknownDeletes.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ public boolean needsPniSignature(final RecipientId recipientId) {
}

public void markUndiscoverablePossiblyUnregistered(final Set<String> numbers) {
logger.debug("Marking {} numbers as unregistered", numbers.size());
logger.debug("Marking {} numbers as undiscoverable", numbers.size());
try (final var connection = database.getConnection()) {
connection.setAutoCommit(false);
for (final var number : numbers) {
Expand Down

0 comments on commit c05b47e

Please sign in to comment.