Add support to kotlin.time APIs in the rate limit interceptor (#9797)

* Add support to kotlin.time APIs in the rate limit interceptor.

* Add a missing line break in the doc.

* Move the specific host to the same file.

* Add kotlin.time rule to Proguard and remove specific host rule.

* Mark the old version as deprecated and address review.

* Remove unused import.

* Remove yet another unused import.

(cherry picked from commit 9b6567f5e4bfa4b8a4845400216551fd28545094)
This commit is contained in:
Alessandro Jean
2023-08-04 18:11:43 -03:00
committed by Jobobby04
parent c9a38ea872
commit abca69a078
4 changed files with 87 additions and 14 deletions
@@ -27,7 +27,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
import tachiyomi.core.util.lang.withIOContext
import uy.kohesive.injekt.injectLazy
import java.util.Calendar
import java.util.concurrent.TimeUnit
import kotlin.time.Duration.Companion.minutes
class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
@@ -35,7 +35,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
private val authClient = client.newBuilder()
.addInterceptor(interceptor)
.rateLimit(permits = 85, period = 1, unit = TimeUnit.MINUTES)
.rateLimit(permits = 85, period = 1.minutes)
.build()
suspend fun addLibManga(track: Track): Track {