ExceptionsOnlyLimiter

class ExceptionsOnlyLimiter(defaultTooManyRequestsDelay: MilliSeconds) : RequestLimiter

This limiter will limit requests only after getting a RetryAfterError or ClientRequestException with HttpStatusCode.TooManyRequests status code. Important thing is that in case if some of block has been blocked, all the others will wait until it will be possible to be called

Parameters

defaultTooManyRequestsDelay

This parameter will be used in case of getting ClientRequestException with HttpStatusCode.TooManyRequests as a parameter for delay like it would be TooMuchRequestsException. The reason of it is that in ClientRequestException there is no information about required delay between requests

Constructors

ExceptionsOnlyLimiter
Link copied to clipboard
common
fun ExceptionsOnlyLimiter(defaultTooManyRequestsDelay: MilliSeconds = 1000L)

Functions

limit
Link copied to clipboard
common
open suspend override fun <T> limit(block: suspend () -> T): T

Use limit for working of block (like delay between or after, for example)