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

View File

@ -183,7 +183,7 @@ class Relay(
}
fun markConnectionAsReady(pingInMs: Long, usingCompression: Boolean) {
this.afterEOSEPerSubscription.clear()
this.resetEOSEStatuses()
this.isReady = true
this.pingInMs = pingInMs
this.usingCompression = usingCompression
@ -193,7 +193,7 @@ class Relay(
this.socket = null
this.isReady = false
this.usingCompression = false
this.afterEOSEPerSubscription.clear()
this.resetEOSEStatuses()
this.closingTimeInSeconds = TimeUtils.now()
}
@ -270,7 +270,13 @@ class Relay(
socket = null
isReady = false
usingCompression = false
afterEOSEPerSubscription.clear()
resetEOSEStatuses()
}
fun resetEOSEStatuses() {
afterEOSEPerSubscription.forEach {
afterEOSEPerSubscription[it.key] = false
}
}
fun sendFilter(requestId: String) {
@ -290,7 +296,7 @@ class Relay(
socket?.send(request)
eventUploadCounterInBytes += request.bytesUsedInMemory()
afterEOSEPerSubscription.clear()
resetEOSEStatuses()
}
}
} else {

View File

@ -346,7 +346,7 @@ class UserMetadata {
}
@Stable
data class ImmutableListOfLists<T>(val lists: Array<Array<T>>)
class ImmutableListOfLists<T>(val lists: Array<Array<T>>)
val EmptyTagList = ImmutableListOfLists<String>(emptyArray())