Limit amount of updates loaded for widget

Probably fixes #9868

(cherry picked from commit 87530f506e16db3d5c9ed89740c324ebd464117f)

# Conflicts:
#	domain/src/main/java/tachiyomi/domain/updates/interactor/GetUpdates.kt
This commit is contained in:
arkon
2023-08-27 22:05:52 -04:00
committed by Jobobby04
parent e776d455f5
commit 511979045f
5 changed files with 28 additions and 26 deletions
@@ -11,11 +11,12 @@ class UpdatesRepositoryImpl(
private val databaseHandler: DatabaseHandler,
) : UpdatesRepository {
override suspend fun awaitWithRead(read: Boolean, after: Long): List<UpdatesWithRelations> {
override suspend fun awaitWithRead(read: Boolean, after: Long, limit: Long): List<UpdatesWithRelations> {
return databaseHandler.awaitList {
updatesViewQueries.getUpdatesByReadStatus(
read = read,
after = after,
limit = limit,
mapper = updateWithRelationMapper,
)
}
@@ -30,11 +31,12 @@ class UpdatesRepositoryImpl(
}
}
override fun subscribeWithRead(read: Boolean, after: Long): Flow<List<UpdatesWithRelations>> {
override fun subscribeWithRead(read: Boolean, after: Long, limit: Long): Flow<List<UpdatesWithRelations>> {
return databaseHandler.subscribeToList {
updatesViewQueries.getUpdatesByReadStatus(
read = read,
after = after,
limit = limit,
mapper = updateWithRelationMapper,
)
}
@@ -30,4 +30,5 @@ getUpdatesByReadStatus:
SELECT *
FROM updatesView
WHERE read = :read
AND dateUpload > :after;
AND dateUpload > :after
LIMIT :limit;