Skip to content

Commit

Permalink
fix(asgilook): directly use redis.asyncio.from_url()
Browse files Browse the repository at this point in the history
  • Loading branch information
vytas7 committed Mar 2, 2024
1 parent f827023 commit a4221d3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/user/tutorial-asgi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ any problems with importing local utility modules or checking code coverage::
$ mkdir -p tests
$ touch tests/__init__.py

Next, let's implement fixtures to replace ``uuid`` and ``aioredis``, and inject them
Next, let's implement fixtures to replace ``uuid`` and ``redis``, and inject them
into our tests via ``conftest.py`` (place your code in the newly created ``tests``
directory):

Expand Down
8 changes: 2 additions & 6 deletions examples/asgilook/asgilook/config.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import os
import pathlib
import redis.asyncio
import uuid


def from_url_wrapper(url):
pool = redis.ConnectionPool.from_url(url)
return redis.Redis.from_pool(pool)


class Config:
DEFAULT_CONFIG_PATH = '/tmp/asgilook'
DEFAULT_MIN_THUMB_SIZE = 64
DEFAULT_REDIS_FROM_URL = redis.asyncio.from_url
DEFAULT_REDIS_HOST = 'redis://localhost'
DEFAULT_UUID_GENERATOR = uuid.uuid4
DEFAULT_REDIS_FROM_URL = from_url_wrapper

def __init__(self):
self.storage_path = pathlib.Path(
Expand Down
2 changes: 1 addition & 1 deletion examples/asgilook/requirements/asgilook
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiofiles>=0.4.0
aioredis>=2.0
redis>=5.0
msgpack
Pillow>=6.0.0

0 comments on commit a4221d3

Please sign in to comment.