Fix _initiate_shutdown NameError by moving function before lifespan
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
bea85e6b28
commit
93b753dedb
@ -60,6 +60,12 @@ async def _periodic_leaderboard_refresh():
|
||||
logger.error(f"Leaderboard refresh failed: {e}")
|
||||
|
||||
|
||||
async def _initiate_shutdown():
|
||||
"""Initiate graceful shutdown."""
|
||||
logger.info("Received shutdown signal")
|
||||
_shutdown_event.set()
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
"""Application lifespan handler for async service initialization."""
|
||||
@ -212,12 +218,6 @@ async def lifespan(app: FastAPI):
|
||||
logger.info("Shutdown complete")
|
||||
|
||||
|
||||
async def _initiate_shutdown():
|
||||
"""Initiate graceful shutdown."""
|
||||
logger.info("Received shutdown signal")
|
||||
_shutdown_event.set()
|
||||
|
||||
|
||||
async def _close_all_websockets():
|
||||
"""Close all active WebSocket connections gracefully."""
|
||||
for room in list(room_manager.rooms.values()):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user