mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Improve message processing performance.
This commit is contained in:
committed by
Greyson Parrelli
parent
7eebb38eda
commit
61ba2ac97a
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user