Extend merge/split logging

This commit is contained in:
AsamK 2025-04-09 20:44:10 +02:00
parent ce813e4529
commit 1e685c7cab
2 changed files with 10 additions and 4 deletions

View file

@ -83,10 +83,11 @@ public class MergeRecipientHelper {
recipientsToBeStripped.add(recipient);
}
logger.debug("Got separate recipients for high trust identifiers {}, need to merge ({}) and strip ({})",
logger.debug("Got separate recipients for high trust identifiers {}, need to merge ({}, {}) and strip ({})",
address,
recipientsToBeMerged.stream().map(r -> r.id().toString()).collect(Collectors.joining(", ")),
recipientsToBeStripped.stream().map(r -> r.id().toString()).collect(Collectors.joining(", ")));
resultingRecipient.map(RecipientWithAddress::address),
recipientsToBeMerged.stream().map(r -> r.address().toString()).collect(Collectors.joining(", ")),
recipientsToBeStripped.stream().map(r -> r.address().toString()).collect(Collectors.joining(", ")));
RecipientAddress finalAddress = resultingRecipient.map(RecipientWithAddress::address).orElse(null);
for (final var recipient : recipientsToBeMerged) {

View file

@ -994,7 +994,12 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
) throws SQLException {
markUnregistered(connection, recipientId);
final var address = resolveRecipientAddress(connection, recipientId);
if (address.aci().isPresent() && address.pni().isPresent()) {
final var needSplit = address.aci().isPresent() && address.pni().isPresent();
logger.trace("Marking unregistered recipient {} as unregistered (and split={}): {}",
recipientId,
needSplit,
address);
if (needSplit) {
final var numberAddress = new RecipientAddress(address.pni().get(), address.number().orElse(null));
updateRecipientAddress(connection, recipientId, address.removeIdentifiersFrom(numberAddress));
addNewRecipient(connection, numberAddress);