Fix: Redis listener attached at startup (#5516)

This commit is contained in:
tofarr
2024-12-11 07:39:57 -07:00
committed by GitHub
parent a60ee09881
commit a6d1a4c98f
2 changed files with 17 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
import warnings
from contextlib import asynccontextmanager
with warnings.catch_warnings():
warnings.simplefilter('ignore')
@@ -21,10 +22,17 @@ from openhands.server.routes.feedback import app as feedback_api_router
from openhands.server.routes.files import app as files_api_router
from openhands.server.routes.public import app as public_api_router
from openhands.server.routes.security import app as security_api_router
from openhands.server.shared import config
from openhands.server.shared import config, session_manager
from openhands.utils.import_utils import get_impl
app = FastAPI()
@asynccontextmanager
async def _lifespan(app: FastAPI):
async with session_manager:
yield
app = FastAPI(lifespan=_lifespan)
app.add_middleware(
LocalhostCORSMiddleware,
allow_credentials=True,