BusyTimeoutSQLiteDriver

class BusyTimeoutSQLiteDriver(delegate: SQLiteDriver, busyTimeoutMs: Long = DEFAULT_BUSY_TIMEOUT_MS) : SQLiteDriver(source)

Wraps a SQLiteDriver so every connection it opens waits up to busyTimeoutMs for a competing connection's lock instead of failing immediately with SQLITE_BUSY ("Error code: 5, message: database is locked").

Each database normally holds one writer connection (see configureCommon), but DatabaseManager's wedge recovery can leave an abandoned callback's connection open beside a replacement pool on the same file (see abandonWedgedDbBlock). Recovery never publishes a replacement while another connection holds the write lock, so this timeout only covers overlaps that begin afterwards. Room raises any timeout below 3s on open, and runs its invalidation-tracker trigger sync (TriggerBasedInvalidationTracker.syncTriggers) under BEGIN IMMEDIATE with its SQLITE_BUSY uncaught, so a lock held past this timeout is fatal.

Constructors

Link copied to clipboard
constructor(delegate: SQLiteDriver, busyTimeoutMs: Long = DEFAULT_BUSY_TIMEOUT_MS)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open override fun open(fileName: String): SQLiteConnection