RajanS
06/11/2021, 9:46 AMprivate 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 advancedave
06/11/2021, 9:48 AMRajanS
06/11/2021, 10:08 AMdave
06/11/2021, 10:11 AM