Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mdumandag committed Jul 10, 2023
1 parent 6f2b708 commit 5474d72
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ You also have the option to try and wait for a request to pass in the given time

It is very similar to the `limit` method and takes an identifier and returns the same
response. However if the current limit has already been exceeded, it will automatically
wait until the next window starts and will try again. Setting the timeout parameter (in seconbds) will cause the method to block a finite amount of time.
wait until the next window starts and will try again. Setting the timeout parameter (in seconds) will cause the method to block a finite amount of time.

```python
from upstash_ratelimit import Ratelimit, SlidingWindow
Expand Down
28 changes: 13 additions & 15 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "upstash-ratelimit"
version = "0.4.2"
version = "0.5.0"
description = "Serverless ratelimiting package from Upstash"
authors = ["Upstash <support@upstash.com>", "Zgîmbău Tudor <tudor.zgimbau@gmail.com>"]
maintainers = ["Upstash <support@upstash.com>"]
Expand All @@ -26,7 +26,7 @@ packages = [{include = "upstash_ratelimit"}]

[tool.poetry.dependencies]
python = "^3.8"
upstash-redis = "^0.14.5"
upstash-redis = "^0.15.0"

[tool.poetry.group.dev.dependencies]
pytest = "^7.3.0"
Expand Down
3 changes: 1 addition & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ def redis():

@pytest_asyncio.fixture
async def async_redis():
redis = AsyncRedis.from_env()
async with redis:
async with AsyncRedis.from_env() as redis:
yield redis


Expand Down
2 changes: 1 addition & 1 deletion upstash_ratelimit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.4.2"
__version__ = "0.5.0"

from upstash_ratelimit.limiter import FixedWindow, Response, SlidingWindow, TokenBucket
from upstash_ratelimit.ratelimit import Ratelimit
Expand Down
5 changes: 1 addition & 4 deletions upstash_ratelimit/limiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ async def _with_at_most_one_request_async(
return response

command: Callable = getattr(redis, command_name)
# TODO: Remove async with once we release the new version of the client
async with redis:
command_response = await command(*command_args)

command_response = await command(*command_args)
response = generator.send(command_response)
return response

Expand Down

0 comments on commit 5474d72

Please sign in to comment.