Hello guys, we are trying out the RateLimit functionality and we can’t get it work as we expected.
Here is how we set up the client:
private fun client(uri: Uri): HttpHandler =
SetBaseUriFrom(uri)
.then(RateLimit())
.then(OkHttp(okHttpClient(100)))
Note: It’s using the default RateLimitConfig which is documented as
By default, handles maximum of 50 requests per 5 seconds.
Here is how we are testing this out:
fun main(){
val timeTaken = measureTimeMillis {
makeMultipleRequests(51, client(Uri.of("<http://localhost:3002/some-url>")))
}
println(timeTaken)
}
I would expect the time taken to be greater than 5 seconds? Is this is how it’s suppose to work?
Running it a few times to get an average it seems to complete in around 2-3 seconds.
Thanks in advance