diff --git a/README.md b/README.md index 8da41b0..ec148a6 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Over a year ago (early 2022) I did a job search, and some of the interview proce - [ ] implement token bucket - [ ] in-app - - [x] in-memory - - [ ] redis + - [x] in-memory, lazy refill + - [ ] redis, process to refill - [ ] implement leaky bucket - in-app - [x] redis diff --git a/my_limiter/algos.py b/my_limiter/algos.py index b210abf..ed734f0 100644 --- a/my_limiter/algos.py +++ b/my_limiter/algos.py @@ -33,8 +33,6 @@ def leaking_bucket_enqueue(identifier: str, data: str) -> None: Requests are pulled from the queue and processed at regular intervals in `leaking_bucket_dequeue` - TODO: implement `leaking_bucket_dequeue` - - [ ] done """ store_name = f"{STORE_NAME_PREFIX_LEAKING_BUCKET}:{identifier}" @@ -89,7 +87,7 @@ def get_entry_from_token_bucket(identifier: str) -> dict | None: return TOKEN_BUCKET.get(identifier) -def token_bucket(identifier: str) -> str: +def token_bucket_in_memory_lazy_refill(identifier: str) -> str: """ Tokens are put in the bucket at preset rates periodically. Once the bucket is full, no more tokens are added.