Improve message processing performance.

This commit is contained in:
Cody Henthorne
2026-02-26 10:43:00 -05:00
committed by Greyson Parrelli
parent 7eebb38eda
commit 61ba2ac97a
11 changed files with 166 additions and 81 deletions

View File

@@ -385,6 +385,22 @@ open class SignalDatabase(private val context: Application, databaseSecret: Data
}
}
/**
* Mirrors [runInTransaction] but instead of returning the result of calling block it returns
* whether the transaction completed successfully.
*/
@JvmStatic
fun tryRunInTransaction(block: (SignalSQLiteDatabase) -> Unit): Boolean {
var committed = false
instance!!.signalWritableDatabase.withinTransaction {
block(it)
it.runPostSuccessfulTransaction { committed = true }
}
return committed
}
@get:JvmStatic
@get:JvmName("attachments")
val attachments: AttachmentTable