INNER CODE UNIT · Python
get_redis_pool
leonh/redis-streams-fastapi-chat · chat.py:100
async def get_redis_pool():
try:
redis_url = f"redis://{REDIS_HOST}:{REDIS_PORT}"
pool = await aioredis.from_url(
redis_url,
encoding='utf-8',
decode_responses=True
)
return pool
except ConnectionRefusedError as e:
print('cannot connect to redis on:', REDIS_HOST, REDIS_PORT)
return None
async def get_chat_history():
pass