From 4cfe1f462f7d9d6aa7216df10a91601a18dcbac4 Mon Sep 17 00:00:00 2001 From: Riztard Lanthorn Date: Mon, 24 May 2021 20:31:16 +0700 Subject: [PATCH] RainOfSnow: add rate limit 2/s (#7205) --- src/en/rainofsnow/build.gradle | 6 +++++- .../kanade/tachiyomi/extension/en/rainofsnow/RainOfSnow.kt | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/en/rainofsnow/build.gradle b/src/en/rainofsnow/build.gradle index bc0dfd10c..86b8f4fb6 100644 --- a/src/en/rainofsnow/build.gradle +++ b/src/en/rainofsnow/build.gradle @@ -5,9 +5,13 @@ ext { extName = 'Rain Of Snow' pkgNameSuffix = 'en.rainofsnow' extClass = '.RainOfSnow' - extVersionCode = 6 + extVersionCode = 7 libVersion = '1.2' containsNsfw = false } +dependencies { + implementation project(path: ':lib-ratelimit') +} + apply from: "$rootDir/common.gradle" diff --git a/src/en/rainofsnow/src/eu/kanade/tachiyomi/extension/en/rainofsnow/RainOfSnow.kt b/src/en/rainofsnow/src/eu/kanade/tachiyomi/extension/en/rainofsnow/RainOfSnow.kt index 2bb6ca366..2ba65c985 100644 --- a/src/en/rainofsnow/src/eu/kanade/tachiyomi/extension/en/rainofsnow/RainOfSnow.kt +++ b/src/en/rainofsnow/src/eu/kanade/tachiyomi/extension/en/rainofsnow/RainOfSnow.kt @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.extension.en.rainofsnow +import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -28,9 +29,12 @@ open class RainOfSnow() : ParsedHttpSource() { override val supportsLatest = false + private val rateLimitInterceptor = RateLimitInterceptor(2) + override val client: OkHttpClient = network.cloudflareClient.newBuilder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) + .addNetworkInterceptor(rateLimitInterceptor) .build() override fun popularMangaRequest(page: Int): Request {