(app: FastAPI)
| 57 | |
| 58 | @asynccontextmanager |
| 59 | async def lifespan(app: FastAPI): |
| 60 | # Runs once in each uvicorn worker, so each gets its own pool. |
| 61 | asyncio.get_running_loop().set_default_executor( |
| 62 | ThreadPoolExecutor(max_workers=IO_THREADS, thread_name_prefix="io") |
| 63 | ) |
| 64 | await api_handlers.startup_handlers() |
| 65 | yield |
| 66 | await api_handlers.shutdown_handlers() |
| 67 | await close_redis() |
| 68 | |
| 69 | # Setup FastAPI app |
| 70 | app = FastAPI(lifespan=lifespan) |
nothing calls this directly
no test coverage detected