1
1
package com.powersync.db.internal
2
2
3
- import co.touchlab.kermit.Logger
4
3
import com.powersync.ExperimentalPowerSyncAPI
5
4
import com.powersync.db.SqlCursor
6
5
import com.powersync.db.ThrowableLockCallback
@@ -11,7 +10,6 @@ import com.powersync.db.runWrapped
11
10
import com.powersync.utils.AtomicMutableSet
12
11
import com.powersync.utils.JsonUtil
13
12
import com.powersync.utils.throttle
14
- import kotlinx.atomicfu.atomic
15
13
import kotlinx.coroutines.Dispatchers
16
14
import kotlinx.coroutines.IO
17
15
import kotlinx.coroutines.flow.Flow
@@ -27,7 +25,6 @@ import kotlin.time.Duration.Companion.milliseconds
27
25
@OptIn(ExperimentalPowerSyncAPI ::class )
28
26
internal class InternalDatabaseImpl (
29
27
private val pool : SQLiteConnectionPool ,
30
- private val logger : Logger ,
31
28
) : InternalDatabase {
32
29
// Could be scope.coroutineContext, but the default is GlobalScope, which seems like a bad idea. To discuss.
33
30
private val dbContext = Dispatchers .IO
@@ -118,13 +115,10 @@ internal class InternalDatabaseImpl(
118
115
triggerImmediately : Boolean ,
119
116
): Flow <Set <String >> =
120
117
flow {
121
- val id = debugFlowId.getAndIncrement()
122
118
val batchedUpdates = AtomicMutableSet <String >()
123
119
124
120
updatesOnTables()
125
121
.onSubscription {
126
- logger.v { " rawChangedTables($id ): Start with $tableNames " }
127
-
128
122
if (triggerImmediately) {
129
123
// Emit an initial event (if requested). No changes would be detected at this point
130
124
emit(initialUpdateSentinel)
@@ -149,9 +143,7 @@ internal class InternalDatabaseImpl(
149
143
.throttle(throttleMs.milliseconds)
150
144
.collect {
151
145
val entries = batchedUpdates.toSetAndClear()
152
- logger.v { " rawChangedTables($id ): Emitting with $entries " }
153
146
emit(entries)
154
- logger.v { " rawChangedTables($id ): Done emitting" }
155
147
}
156
148
}
157
149
@@ -267,7 +259,6 @@ internal class InternalDatabaseImpl(
267
259
268
260
private companion object {
269
261
val initialUpdateSentinel = emptySet<String >()
270
- private val debugFlowId = atomic(0L )
271
262
}
272
263
}
273
264
0 commit comments