Refines user status flow and isExpired running

This commit is contained in:
Vitor Pamplona
2026-03-13 13:45:22 -04:00
parent 99eaa37d4c
commit 00f2d46b53
2 changed files with 20 additions and 9 deletions
@@ -62,12 +62,15 @@ class UserStatusCache : UserDependencies {
}
fun removeExpired() {
statuses.update { list ->
val filtered = list.filter { it.event?.isExpired() != true }
if (filtered.size != list.size) {
filtered.toImmutableList()
} else {
list
val hasExpired = statuses.value.any { it.event?.isExpired() == true }
if (hasExpired) {
statuses.update { list ->
val filtered = list.filter { it.event?.isExpired() != true }
if (filtered.size != list.size) {
filtered.toImmutableList()
} else {
list
}
}
}
}