Remove job adds from database transactions.

This commit is contained in:
Greyson Parrelli
2020-12-03 17:33:04 -05:00
parent 31960b53a0
commit 97047bccde
6 changed files with 63 additions and 43 deletions

View File

@@ -1302,7 +1302,6 @@ public class MmsDatabase extends MessageDatabase {
}
notifyConversationListeners(threadId);
ApplicationDependencies.getJobManager().add(new TrimThreadJob(threadId));
return Optional.of(new InsertResult(messageId, threadId));
}

View File

@@ -866,13 +866,16 @@ public class SmsDatabase extends MessageDatabase {
db.insert(TABLE_NAME, null, values);
notifyConversationListeners(threadId);
ApplicationDependencies.getJobManager().add(new TrimThreadJob(threadId));
});
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
Stream.of(threadIdsToUpdate)
.withoutNulls()
.forEach(threadId -> ApplicationDependencies.getJobManager().add(new TrimThreadJob(threadId)));
}
@Override