feat(database): enable WAL connection pool for parallel reads

Room 3.0.0-alpha04 adds setMultipleConnectionPool(). Enable it with
4 readers / 1 writer to allow concurrent read operations (paging,
multiple Flow collectors) without contention.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
James Rich
2026-05-06 13:36:39 -05:00
parent 78b9a942dc
commit dddba0704f

View File

@@ -120,7 +120,9 @@ abstract class MeshtasticDatabase : RoomDatabase() {
companion object {
/** Configures a [RoomDatabase.Builder] with standard settings for this project. */
fun <T : RoomDatabase> RoomDatabase.Builder<T>.configureCommon(): RoomDatabase.Builder<T> =
this.fallbackToDestructiveMigration(dropAllTables = false).setQueryCoroutineContext(ioDispatcher)
this.fallbackToDestructiveMigration(dropAllTables = false)
.setMultipleConnectionPool(maxNumOfReaders = 4, maxNumOfWriters = 1)
.setQueryCoroutineContext(ioDispatcher)
}
}