mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-25 04:57:54 +00:00
ci: fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# pyright: reportGeneralTypeIssues=false
|
||||
from contextlib import asynccontextmanager
|
||||
import time
|
||||
from contextlib import asynccontextmanager
|
||||
from typing import AsyncIterator
|
||||
|
||||
import pendulum
|
||||
@@ -19,6 +19,7 @@ from starlette.responses import JSONResponse, Response
|
||||
import redis.asyncio as redis
|
||||
from redis.asyncio.connection import ConnectionPool
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(_: FastAPI) -> AsyncIterator[None]:
|
||||
pool = ConnectionPool.from_url(url="redis://redis")
|
||||
@@ -65,7 +66,7 @@ async def get_data(request: Request, response: Response):
|
||||
# Note: This function MUST be sync to demonstrate fastapi-cache's correct handling,
|
||||
# i.e. running cached sync functions in threadpool just like FastAPI itself!
|
||||
@app.get("/blocking")
|
||||
@cache(namespace="test", expire=10)
|
||||
@cache(namespace="test", expire=10) # pyright: ignore[reportArgumentType]
|
||||
def blocking():
|
||||
time.sleep(2)
|
||||
return {"ret": 42}
|
||||
|
||||
Reference in New Issue
Block a user