Skip to content

Instantly share code, notes, and snippets.

@DannyMor
Last active April 20, 2020 15:34
Show Gist options
  • Save DannyMor/8e45affff28d3f6b9e3ac5fc8cc04e1e to your computer and use it in GitHub Desktop.
Save DannyMor/8e45affff28d3f6b9e3ac5fc8cc04e1e to your computer and use it in GitHub Desktop.
rate limiter 1
class RateLimiter:
def __init__(self, rate_limit: int) -> None:
self.rate_limit = rate_limit
self.tokens_queue = asyncio.Queue(rate_limit)
self.tokens_consumer_task = asyncio.create_task(self.consume_tokens())
async def add_token(self) -> None:
pass
async def consume_tokens(self) -> None:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment