Faster user in follow list algo

This commit is contained in:
Vitor Pamplona
2023-04-02 11:42:11 -04:00
parent 9afc94c050
commit 67bcc52b25
@@ -273,7 +273,7 @@ class User(val pubkeyHex: String) {
} }
fun transientFollowerCount(): Int { fun transientFollowerCount(): Int {
return LocalCache.users.values.count { it.latestContactList?.let { pubkeyHex in it.unverifiedFollowKeySet() } ?: false } return LocalCache.users.values.count { it.latestContactList?.isTaggedUser(pubkeyHex) ?: false }
} }
fun cachedFollowingKeySet(): Set<HexKey> { fun cachedFollowingKeySet(): Set<HexKey> {
@@ -289,7 +289,7 @@ class User(val pubkeyHex: String) {
} }
fun cachedFollowerCount(): Int { fun cachedFollowerCount(): Int {
return LocalCache.users.values.count { it.latestContactList?.let { pubkeyHex in it.unverifiedFollowKeySet() } ?: false } return LocalCache.users.values.count { it.latestContactList?.isTaggedUser(pubkeyHex) ?: false }
} }
fun hasSentMessagesTo(user: User?): Boolean { fun hasSentMessagesTo(user: User?): Boolean {