File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
core/src/commonMain/kotlin/com/powersync/db Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,11 @@ import com.powersync.utils.JsonParam
2424import com.powersync.utils.JsonUtil
2525import com.powersync.utils.throttle
2626import com.powersync.utils.toJsonObject
27+ import kotlinx.coroutines.CancellationException
2728import kotlinx.coroutines.CoroutineScope
2829import kotlinx.coroutines.FlowPreview
2930import kotlinx.coroutines.Job
3031import kotlinx.coroutines.SupervisorJob
31- import kotlinx.coroutines.cancelAndJoin
3232import kotlinx.coroutines.ensureActive
3333import kotlinx.coroutines.flow.Flow
3434import kotlinx.coroutines.flow.filter
@@ -164,7 +164,7 @@ internal class PowerSyncDatabaseImpl(
164164 this .syncStream = stream
165165
166166 val db = this
167- val job = SupervisorJob ()
167+ val job = SupervisorJob (scope.coroutineContext[ Job ] )
168168 syncSupervisorJob = job
169169 scope.launch(job) {
170170 launch {
@@ -367,7 +367,8 @@ internal class PowerSyncDatabaseImpl(
367367 private suspend fun disconnectInternal () {
368368 val syncJob = syncSupervisorJob
369369 if (syncJob != null && syncJob.isActive) {
370- syncJob.cancelAndJoin()
370+ syncJob.cancel(CancellationException (" disconnect() called" ))
371+ syncJob.join()
371372 syncSupervisorJob = null
372373 }
373374
You can’t perform that action at this time.
0 commit comments