Fix SQLiteException in resolveRecipient by checking cache before opening connection (#2011)

This commit is contained in:
tonycpsu 2026-04-11 06:23:15 -04:00 committed by GitHub
parent 2651823d4d
commit 132dfb95dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -184,12 +184,12 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
@Override
public RecipientId resolveRecipient(final ServiceId serviceId) {
final var recipientWithAddress = recipientAddressCache.get(serviceId);
if (recipientWithAddress != null) {
return recipientWithAddress.id();
}
try (final var connection = database.getConnection()) {
connection.setAutoCommit(false);
final var recipientWithAddress = recipientAddressCache.get(serviceId);
if (recipientWithAddress != null) {
return recipientWithAddress.id();
}
final var recipientId = resolveRecipientLocked(connection, serviceId);
connection.commit();
return recipientId;