diff --git a/CHANGELOG.md b/CHANGELOG.md index 12450362..38348bec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ # Changelog +## 1.0.0-BETA13 + +* Move iOS database driver to use IO dispatcher which should avoid race conditions and improve performance. + ## 1.0.0-BETA12 -* Use transaction context in `writeTransaction` in `BucketStorageImpl` to avoid race condition issues in Swift SDK. +* Use transaction context in `writeTransaction` in `BucketStorageImpl`. ## 1.0.0-BETA11 diff --git a/core/src/iosMain/kotlin/com/powersync/DatabaseDriverFactory.ios.kt b/core/src/iosMain/kotlin/com/powersync/DatabaseDriverFactory.ios.kt index adb40057..c3a9822c 100644 --- a/core/src/iosMain/kotlin/com/powersync/DatabaseDriverFactory.ios.kt +++ b/core/src/iosMain/kotlin/com/powersync/DatabaseDriverFactory.ios.kt @@ -17,6 +17,8 @@ import kotlinx.cinterop.asStableRef import kotlinx.cinterop.staticCFunction import kotlinx.cinterop.toKString import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.IO @Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") @OptIn(ExperimentalForeignApi::class) @@ -51,10 +53,13 @@ public actual class DatabaseDriverFactory { scope: CoroutineScope, dbFilename: String, ): PsSqlDriver { + val dbDispatcher = Dispatchers.IO + val dbScope = CoroutineScope(scope.coroutineContext + dbDispatcher) + val schema = InternalSchema.synchronous() this.driver = PsSqlDriver( - scope = scope, + scope = dbScope, driver = NativeSqliteDriver( configuration = diff --git a/gradle.properties b/gradle.properties index e837668d..e4e9ef3c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ development=true RELEASE_SIGNING_ENABLED=true # Library config GROUP=com.powersync -LIBRARY_VERSION=1.0.0-BETA12 +LIBRARY_VERSION=1.0.0-BETA13 GITHUB_REPO=https://github.com/powersync-ja/powersync-kotlin.git # POM POM_URL=https://github.com/powersync-ja/powersync-kotlin/