Throttle Wikipedia requests
This commit is contained in:
parent
21a5501a75
commit
09b856e71c
@ -39,6 +39,7 @@ import de.mm20.launcher2.wikipedia.WikipediaRepository
|
|||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
import kotlinx.collections.immutable.toImmutableList
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.channelFlow
|
import kotlinx.coroutines.flow.channelFlow
|
||||||
@ -194,6 +195,7 @@ internal class SearchServiceImpl(
|
|||||||
}
|
}
|
||||||
if (wikipedia.enabled) {
|
if (wikipedia.enabled) {
|
||||||
launch {
|
launch {
|
||||||
|
delay(750)
|
||||||
wikipediaRepository.search(query, loadImages = wikipedia.images)
|
wikipediaRepository.search(query, loadImages = wikipedia.images)
|
||||||
.map { it?.let { listOf(it) } ?: listOf() }
|
.map { it?.let { listOf(it) } ?: listOf() }
|
||||||
.withCustomLabels(customAttributesRepository)
|
.withCustomLabels(customAttributesRepository)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user