Delete storage id of unregistered recipients after remote update

This commit is contained in:
AsamK 2024-12-25 17:19:33 +01:00
parent ac145e6a27
commit c05b47e4d0
2 changed files with 13 additions and 12 deletions

View file

@ -198,17 +198,6 @@ public class StorageHelper {
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,
@ -227,6 +216,18 @@ public class StorageHelper {
.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());

View file

@ -934,7 +934,7 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
}
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) {