fix(migration): Throttle E-Hentai requests (#1420)
This commit is contained in:
parent
7e71162519
commit
505c8c23f0
1 changed files with 18 additions and 10 deletions
|
|
@ -63,6 +63,7 @@ class MigrationListScreenModel(
|
||||||
) : StateScreenModel<MigrationListScreenModel.State>(State()) {
|
) : StateScreenModel<MigrationListScreenModel.State>(State()) {
|
||||||
|
|
||||||
private val smartSearchEngine = SmartSourceSearchEngine(extraSearchQuery)
|
private val smartSearchEngine = SmartSourceSearchEngine(extraSearchQuery)
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
private val throttleManager = ThrottleManager()
|
private val throttleManager = ThrottleManager()
|
||||||
// SY <--
|
// SY <--
|
||||||
|
|
@ -133,8 +134,10 @@ class MigrationListScreenModel(
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun runMigrations(mangas: List<MigratingManga>) {
|
private suspend fun runMigrations(mangas: List<MigratingManga>) {
|
||||||
// KMK -->
|
// SY -->
|
||||||
throttleManager.resetThrottle()
|
throttleManager.resetThrottle()
|
||||||
|
// SY <--
|
||||||
|
// KMK -->
|
||||||
// val prioritizeByChapters = preferences.migrationPrioritizeByChapters().get()
|
// val prioritizeByChapters = preferences.migrationPrioritizeByChapters().get()
|
||||||
// val deepSearchMode = preferences.migrationDeepSearchMode().get()
|
// val deepSearchMode = preferences.migrationDeepSearchMode().get()
|
||||||
// KMK <--
|
// KMK <--
|
||||||
|
|
@ -222,12 +225,11 @@ class MigrationListScreenModel(
|
||||||
|
|
||||||
val localManga = networkToLocalManga(searchResult)
|
val localManga = networkToLocalManga(searchResult)
|
||||||
try {
|
try {
|
||||||
val chapters =
|
// SY -->
|
||||||
// KMK -->
|
val chapters = if (source is EHentai) {
|
||||||
if (source is EHentai) {
|
|
||||||
source.getChapterList(localManga.toSManga(), throttleManager::throttle)
|
source.getChapterList(localManga.toSManga(), throttleManager::throttle)
|
||||||
} else {
|
} else {
|
||||||
// KMK <--
|
// SY <--
|
||||||
source.getChapterList(localManga.toSManga())
|
source.getChapterList(localManga.toSManga())
|
||||||
}
|
}
|
||||||
syncChaptersWithSource.await(chapters, localManga, source)
|
syncChaptersWithSource.await(chapters, localManga, source)
|
||||||
|
|
@ -271,7 +273,13 @@ class MigrationListScreenModel(
|
||||||
val manga = getManga.await(target) ?: return@async null
|
val manga = getManga.await(target) ?: return@async null
|
||||||
try {
|
try {
|
||||||
val source = sourceManager.get(manga.source)!!
|
val source = sourceManager.get(manga.source)!!
|
||||||
val chapters = source.getChapterList(manga.toSManga())
|
// SY -->
|
||||||
|
val chapters = if (source is EHentai) {
|
||||||
|
source.getChapterList(manga.toSManga(), throttleManager::throttle)
|
||||||
|
} else {
|
||||||
|
// SY <--
|
||||||
|
source.getChapterList(manga.toSManga())
|
||||||
|
}
|
||||||
syncChaptersWithSource.await(chapters, manga, source)
|
syncChaptersWithSource.await(chapters, manga, source)
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
return@async null
|
return@async null
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue