mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-04-11 13:32:03 +02:00
BugFix for too many streams (fix in max = 2 for now)
This commit is contained in:
parent
ce207aed39
commit
2a47cd4fd1
@ -15,9 +15,11 @@ abstract class FeedFilter<T> {
|
||||
}
|
||||
|
||||
Log.d("Time", "${this.javaClass.simpleName} Full Feed in $elapsed with ${feed.size} objects")
|
||||
return feed.take(1000)
|
||||
return feed.take(limit())
|
||||
}
|
||||
|
||||
open fun limit() = 1000
|
||||
|
||||
/**
|
||||
* Returns a string that serves as the key to invalidate the list if it changes.
|
||||
*/
|
||||
@ -38,7 +40,7 @@ abstract class AdditiveFeedFilter<T> : FeedFilter<T>() {
|
||||
val newItemsToBeAdded = applyFilter(newItems)
|
||||
if (newItemsToBeAdded.isNotEmpty()) {
|
||||
val newList = oldList.toSet() + newItemsToBeAdded
|
||||
sort(newList).take(1000)
|
||||
sort(newList).take(limit())
|
||||
} else {
|
||||
oldList
|
||||
}
|
||||
|
@ -49,6 +49,8 @@ class HomeLiveActivitiesFeedFilter(val account: Account) : AdditiveFeedFilter<No
|
||||
.toSet()
|
||||
}
|
||||
|
||||
override fun limit() = 2
|
||||
|
||||
override fun sort(collection: Set<Note>): List<Note> {
|
||||
return collection.sortedWith(compareBy({ it.createdAt() }, { it.idHex })).reversed()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user