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

This commit is contained in:
tonycpsu authored and GitHub committed 2026-04-11 12:23:15 +02:00
1 parent 2651823d4d
commit 132dfb95dc
1 file changed
+4 -4
@@ -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;