Avoids recreating the EOSE array when changing filters.

This commit is contained in:
Vitor Pamplona
2023-12-14 15:52:52 -05:00
parent 3a76c2a2de
commit ed491f5e3a
2 changed files with 11 additions and 5 deletions
@@ -183,7 +183,7 @@ class Relay(
} }
fun markConnectionAsReady(pingInMs: Long, usingCompression: Boolean) { fun markConnectionAsReady(pingInMs: Long, usingCompression: Boolean) {
this.afterEOSEPerSubscription.clear() this.resetEOSEStatuses()
this.isReady = true this.isReady = true
this.pingInMs = pingInMs this.pingInMs = pingInMs
this.usingCompression = usingCompression this.usingCompression = usingCompression
@@ -193,7 +193,7 @@ class Relay(
this.socket = null this.socket = null
this.isReady = false this.isReady = false
this.usingCompression = false this.usingCompression = false
this.afterEOSEPerSubscription.clear() this.resetEOSEStatuses()
this.closingTimeInSeconds = TimeUtils.now() this.closingTimeInSeconds = TimeUtils.now()
} }
@@ -270,7 +270,13 @@ class Relay(
socket = null socket = null
isReady = false isReady = false
usingCompression = false usingCompression = false
afterEOSEPerSubscription.clear() resetEOSEStatuses()
}
fun resetEOSEStatuses() {
afterEOSEPerSubscription.forEach {
afterEOSEPerSubscription[it.key] = false
}
} }
fun sendFilter(requestId: String) { fun sendFilter(requestId: String) {
@@ -290,7 +296,7 @@ class Relay(
socket?.send(request) socket?.send(request)
eventUploadCounterInBytes += request.bytesUsedInMemory() eventUploadCounterInBytes += request.bytesUsedInMemory()
afterEOSEPerSubscription.clear() resetEOSEStatuses()
} }
} }
} else { } else {
@@ -346,7 +346,7 @@ class UserMetadata {
} }
@Stable @Stable
data class ImmutableListOfLists<T>(val lists: Array<Array<T>>) class ImmutableListOfLists<T>(val lists: Array<Array<T>>)
val EmptyTagList = ImmutableListOfLists<String>(emptyArray()) val EmptyTagList = ImmutableListOfLists<String>(emptyArray())