File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/main/kotlin/org/snd/module Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -220,11 +220,22 @@ class MetadataModule(
220220 return AniListClient (
221221 okHttpClient = okHttpClient,
222222 name = " AniList" ,
223+
223224 rateLimiterConfig = RateLimiterConfig .custom()
224225 .limitRefreshPeriod(Duration .ofSeconds(5 ))
225226 .limitForPeriod(5 )
226227 .timeoutDuration(Duration .ofSeconds(5 ))
227- .build()
228+ .build(),
229+
230+ retryConfig = RetryConfig .custom<Any >()
231+ .intervalBiFunction { _, result ->
232+ if (result.isRight) return @intervalBiFunction 5000
233+
234+ val exception = result.left
235+ return @intervalBiFunction if (exception is HttpException && exception.code == 429 ) {
236+ exception.headers[" retry-after" ]?.toLong()?.times(1000 ) ? : 5000
237+ } else 5000
238+ }.build()
228239 )
229240 }
230241
You can’t perform that action at this time.
0 commit comments