mirror of
https://github.com/blindlobstar/go-interview-problems
synced 2025-04-25 19:25:14 +00:00
Rate Limiter
Implement a rate limiter that allows up to n
operations per second. It should provide two methods:
Take()
— blocks until the operation is allowed.CanTake()
— returns immediately withtrue
if the operation is allowed, otherwisefalse
.
The limiter should pace operations using a token-based mechanism like a token bucket.
Tags
Concurrency