File tree Expand file tree Collapse file tree 2 files changed +16
-16
lines changed
commonMain/kotlin/com/powersync/db
commonTest/kotlin/com/powersync/db Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -35,30 +35,31 @@ internal class ActiveDatabaseGroup(
3535 }
3636 }
3737
38- internal open class GroupsCollection : Synchronizable () {
38+ internal open class GroupsCollection : Synchronizable () {
3939 internal val allGroups = mutableListOf<ActiveDatabaseGroup >()
4040
4141 private fun findGroup (
4242 warnOnDuplicate : Logger ,
4343 identifier : String ,
44- ): ActiveDatabaseGroup = synchronize {
45- val existing = allGroups.asSequence().firstOrNull { it.identifier == identifier }
46- val resolvedGroup =
47- if (existing == null ) {
48- val added = ActiveDatabaseGroup (identifier, this )
49- allGroups.add(added)
50- added
51- } else {
52- existing
44+ ): ActiveDatabaseGroup =
45+ synchronize {
46+ val existing = allGroups.asSequence().firstOrNull { it.identifier == identifier }
47+ val resolvedGroup =
48+ if (existing == null ) {
49+ val added = ActiveDatabaseGroup (identifier, this )
50+ allGroups.add(added)
51+ added
52+ } else {
53+ existing
54+ }
55+
56+ if (resolvedGroup.refCount++ != 0 ) {
57+ warnOnDuplicate.w { multipleInstancesMessage }
5358 }
5459
55- if (resolvedGroup.refCount++ != 0 ) {
56- warnOnDuplicate.w { multipleInstancesMessage }
60+ resolvedGroup
5761 }
5862
59- resolvedGroup
60- }
61-
6263 internal fun referenceDatabase (
6364 warnOnDuplicate : Logger ,
6465 identifier : String ,
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ import kotlin.test.assertNotNull
1212
1313@OptIn(ExperimentalKermitApi ::class )
1414class ActiveDatabaseGroupTest {
15-
1615 private val logWriter =
1716 TestLogWriter (
1817 loggable = Severity .Debug ,
You can’t perform that action at this time.
0 commit comments