refactor: cleaned main file

This commit is contained in:
2025-10-31 11:29:24 +04:00
parent 36b3e056dc
commit ef657c4939
8 changed files with 84 additions and 53 deletions

16
core/lifespan.py Normal file
View File

@ -0,0 +1,16 @@
import contextlib
from fastapi.applications import AppType
from task_management import broker
@contextlib.asynccontextmanager
async def lifespan(app: AppType):
if not broker.is_worker_process:
await broker.startup()
yield
if not broker.is_worker_process:
await broker.shutdown()