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.
This commit is contained in:
Alessandro Jean
2023-08-04 18:11:43 -03:00
committed by GitHub
parent 7798186c32
commit 9b6567f5e4
4 changed files with 87 additions and 14 deletions

View File

@@ -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 {