Adds additional logs for the size of observables in the Local Cache

This commit is contained in:
Vitor Pamplona 2024-07-17 09:09:38 -04:00
parent bc6d5060cb
commit 5e42fa5346
3 changed files with 16 additions and 2 deletions

View File

@ -149,8 +149,8 @@ object LocalCache {
val deletionIndex = DeletionIndex() val deletionIndex = DeletionIndex()
private val observablesByKindAndETag = ConcurrentHashMap<Int, ConcurrentHashMap<HexKey, LatestByKindWithETag<Event>>>(10) val observablesByKindAndETag = ConcurrentHashMap<Int, ConcurrentHashMap<HexKey, LatestByKindWithETag<Event>>>(10)
private val observablesByKindAndAuthor = ConcurrentHashMap<Int, ConcurrentHashMap<HexKey, LatestByKindAndAuthor<Event>>>(10) val observablesByKindAndAuthor = ConcurrentHashMap<Int, ConcurrentHashMap<HexKey, LatestByKindAndAuthor<Event>>>(10)
fun <T : Event> observeETag( fun <T : Event> observeETag(
kind: Int, kind: Int,

View File

@ -1071,6 +1071,18 @@ fun debugState(context: Context) {
" / " + " / " +
LocalCache.users.size(), LocalCache.users.size(),
) )
Log.d(
"STATE DUMP",
"Deletion Events: " +
LocalCache.deletionIndex.size(),
)
Log.d(
"STATE DUMP",
"Observable Events: " +
LocalCache.observablesByKindAndETag.size +
" / " +
LocalCache.observablesByKindAndAuthor.size,
)
Log.d( Log.d(
"STATE DUMP", "STATE DUMP",

View File

@ -110,4 +110,6 @@ class DeletionIndex {
val deletionEvent = deletedReferencesBefore.get(key) val deletionEvent = deletedReferencesBefore.get(key)
return deletionEvent != null && createdAt <= deletionEvent.createdAt return deletionEvent != null && createdAt <= deletionEvent.createdAt
} }
fun size() = deletedReferencesBefore.size()
} }