added fitness

This commit is contained in:
2026-06-10 09:12:50 +03:00
parent 0b39692300
commit d0bdd1e95c
25 changed files with 2082 additions and 7 deletions
+8 -3
View File
@@ -7,17 +7,22 @@ from fastapi.middleware.cors import CORSMiddleware
from app.api.routes import api_router
from app.config import get_settings
from app.db.base import init_db
from app.fitness.watcher import fitness_watcher_loop
from app.pomodoro.watcher import pomodoro_watcher_loop
@asynccontextmanager
async def lifespan(_: FastAPI):
init_db()
watcher_task = asyncio.create_task(pomodoro_watcher_loop())
pomodoro_task = asyncio.create_task(pomodoro_watcher_loop())
fitness_task = asyncio.create_task(fitness_watcher_loop())
yield
watcher_task.cancel()
pomodoro_task.cancel()
fitness_task.cancel()
with suppress(asyncio.CancelledError):
await watcher_task
await pomodoro_task
with suppress(asyncio.CancelledError):
await fitness_task
def create_app() -> FastAPI: