소스 검색

Add concurrency to global search queries

inorichi 7 년 전
부모
커밋
a7faf445c4
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchPresenter.kt

+ 3 - 3
app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchPresenter.kt

@@ -118,15 +118,15 @@ class CatalogueSearchPresenter(
 
         fetchSourcesSubscription?.unsubscribe()
         fetchSourcesSubscription = Observable.from(sources)
-                .observeOn(Schedulers.io())
-                .flatMap { source ->
+                .flatMap({ source ->
                     source.fetchSearchManga(1, query, FilterList())
+                            .subscribeOn(Schedulers.io())
                             .onExceptionResumeNext(Observable.empty()) // Ignore timeouts.
                             .map { it.mangas.take(10) } // Get at most 10 manga from search result.
                             .map { it.map { networkToLocalManga(it, source.id) } } // Convert to local manga.
                             .doOnNext { fetchImage(it, source) } // Load manga covers.
                             .map { CatalogueSearchItem(source, it.map { CatalogueSearchCardItem(it) }) }
-                }
+                }, 5)
                 .observeOn(AndroidSchedulers.mainThread())
                 // Update matching source with the obtained results
                 .map { result ->