For the best experience, increase the window size or view on a laptop or desktop device
Title | ||
|---|---|---|
Loading... | ||
For the best experience, increase the window size or view on a laptop or desktop device
Title | ||
|---|---|---|
Loading... | ||
We want to protect an API endpoint with an in-memory rate limiter.
The rate limiter should be initialized with a value that represents the maximum requests per second we want to allow.
When a request hits the API endpoint, the rate limiter is asked whether it has capacity to process this request and will reject or accept the request appropriately.
Assume:
Design the interface and implement the logic for the rate limiter.
Example at a max of 2 requests / sec:
12:00:01.100 PASS
12:00:01.200 PASS
12:00:01.300 FAIL
12:00:02.100 PASS
12:00:02.150 FAIL
12:00:02.200 PASS
Followup:
We want to protect an API endpoint with an in-memory rate limiter.
The rate limiter should be initialized with a value that represents the maximum requests per second we want to allow.
When a request hits the API endpoint, the rate limiter is asked whether it has capacity to process this request and will reject or accept the request appropriately.
Assume:
Design the interface and implement the logic for the rate limiter.
Example at a max of 2 requests / sec:
12:00:01.100 PASS
12:00:01.200 PASS
12:00:01.300 FAIL
12:00:02.100 PASS
12:00:02.150 FAIL
12:00:02.200 PASS
Followup:
Output