Changes related to Docker
This commit is contained in:
@@ -2,7 +2,7 @@ from fastapi import APIRouter, FastAPI, Response, WebSocket, WebSocketDisconnect
|
||||
from fastapi.responses import HTMLResponse
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
import aioredis, asyncio, datetime, hashlib, json, os, pathlib, shutil, time
|
||||
import redis, asyncio, datetime, hashlib, json, os, pathlib, shutil, time
|
||||
|
||||
from app.lib_general import log, logging, common_route_params, Common_Route_Params, common_route_params_min, Common_Route_Params_Min
|
||||
from app.config import settings
|
||||
@@ -191,7 +191,7 @@ async def ws_client_id(
|
||||
|
||||
async def redis_connector(
|
||||
websocket: WebSocket,
|
||||
redis_url: str = "redis://localhost:6379",
|
||||
redis_url: str = f"redis://{settings.REDIS['server']}:{settings.REDIS['port']}",
|
||||
):
|
||||
log.setLevel(logging.DEBUG)
|
||||
log.debug(locals())
|
||||
@@ -214,7 +214,7 @@ async def redis_connector(
|
||||
|
||||
async def producer_handler(r, ws: WebSocket):
|
||||
(channel,) = await r.subscribe("chat:c")
|
||||
assert isinstance(channel, aioredis.Channel)
|
||||
assert isinstance(channel, redis.Channel)
|
||||
try:
|
||||
while True:
|
||||
message = await channel.get()
|
||||
@@ -224,9 +224,9 @@ async def redis_connector(
|
||||
# TODO this needs handling better
|
||||
log.error(exc)
|
||||
|
||||
# redis = await aioredis.create_pool(redis_url)
|
||||
# redis = await redis.create_pool(redis_url)
|
||||
# Redis client bound to pool of connections (auto-reconnecting).
|
||||
redis = aioredis.from_url(
|
||||
redis = redis.from_url(
|
||||
redis_url, encoding="utf-8", decode_responses=True
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user