transactional versions of addPendingContact, getPendingContacts, getConversationId and respondToIntroduction

This commit is contained in:
ialokim
2021-12-10 22:55:44 +01:00
committed by Sebastian Kürten
parent c340071469
commit 5b27eb354c
6 changed files with 73 additions and 17 deletions

View File

@@ -377,6 +377,12 @@ class IntroductionManagerImpl extends ConversationClientImpl
respondToIntroduction(contactId, sessionId, accept, false);
}
@Override
public void respondToIntroduction(Transaction txn, ContactId contactId,
SessionId sessionId, boolean accept) throws DbException {
respondToIntroduction(txn, contactId, sessionId, accept, false);
}
private void respondToIntroduction(ContactId contactId, SessionId sessionId,
boolean accept, boolean isAutoDecline) throws DbException {
db.transaction(false,

View File

@@ -389,14 +389,13 @@ class MessagingManagerImpl implements MessagingManager, IncomingMessageHook,
@Override
public GroupId getConversationId(ContactId c) throws DbException {
Contact contact;
Transaction txn = db.startTransaction(true);
try {
contact = db.getContact(txn, c);
db.commitTransaction(txn);
} finally {
db.endTransaction(txn);
}
return db.transactionWithResult(true,
txn -> getConversationId(txn, c));
}
@Override
public GroupId getConversationId(Transaction txn, ContactId c) throws DbException {
Contact contact = db.getContact(txn, c);
return getContactGroup(contact).getId();
}