Skip unsupported sources in global search

This commit is contained in:
Koitharu
2024-01-20 09:07:27 +02:00
parent ba6afd44dd
commit d6887e2d75

View File

@@ -113,10 +113,14 @@ class MultiSearchViewModel @Inject constructor(
}
val semaphore = Semaphore(MAX_PARALLELISM)
for (source in sources) {
val repository = mangaRepositoryFactory.create(source)
if (!repository.isSearchSupported) {
continue
}
launch {
val item = runCatchingCancellable {
semaphore.withPermit {
mangaRepositoryFactory.create(source).getList(offset = 0, filter = MangaListFilter.Search(q))
repository.getList(offset = 0, filter = MangaListFilter.Search(q))
.toUi(ListMode.GRID, extraProvider)
}
}.fold(