mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-05-15 12:50:37 +00:00
Fix SQLiteException in resolveRecipient by checking cache before opening connection (#2011)
This commit is contained in:
parent
2651823d4d
commit
132dfb95dc
@ -184,12 +184,12 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecipientId resolveRecipient(final ServiceId serviceId) {
|
public RecipientId resolveRecipient(final ServiceId serviceId) {
|
||||||
|
final var recipientWithAddress = recipientAddressCache.get(serviceId);
|
||||||
|
if (recipientWithAddress != null) {
|
||||||
|
return recipientWithAddress.id();
|
||||||
|
}
|
||||||
try (final var connection = database.getConnection()) {
|
try (final var connection = database.getConnection()) {
|
||||||
connection.setAutoCommit(false);
|
connection.setAutoCommit(false);
|
||||||
final var recipientWithAddress = recipientAddressCache.get(serviceId);
|
|
||||||
if (recipientWithAddress != null) {
|
|
||||||
return recipientWithAddress.id();
|
|
||||||
}
|
|
||||||
final var recipientId = resolveRecipientLocked(connection, serviceId);
|
final var recipientId = resolveRecipientLocked(connection, serviceId);
|
||||||
connection.commit();
|
connection.commit();
|
||||||
return recipientId;
|
return recipientId;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user