Implement a token-bucket rate limiter with sliding-window concurrency control in /rate limiter/limiter.py .
Implement a token-bucket rate limiter with sliding-window concurrency control in /rate limiter/limiter.py .: a task in TermGrade Environments: 1,004 executable Linux tasks (Harbor dataset). def acquire(self, thread id: int, timestamp ms: int) - bool: """ Attempt to acquire a token and a…
The task
def acquire(self, thread_id: int, timestamp_ms: int) -> bool: """ Attempt to acquire a token and a concurrency slot at the given timestamp_ms. timestamp_ms is a non-negative integer representing milliseconds since epoch. thread_id is a non-negative integer.
Part of ai-and/termgrade-environments.