feat: add backfills logic
This commit is contained in:
@@ -2,10 +2,10 @@ from collections.abc import AsyncGenerator
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
import asyncpg
|
||||
from dishka.integrations.fastapi import FromDishka, inject, setup_dishka
|
||||
from dishka.integrations.fastapi import DishkaRoute, FromDishka, setup_dishka
|
||||
from fastapi import FastAPI
|
||||
|
||||
from api.routers import folders, policy
|
||||
from api.routers import backfill, folders, policy
|
||||
from dependencies.container import container
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ async def lifespan(app_: FastAPI) -> AsyncGenerator[None]:
|
||||
|
||||
|
||||
app = FastAPI(title="beavergram API", lifespan=lifespan)
|
||||
app.router.route_class = DishkaRoute
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
@inject
|
||||
async def health(pool: FromDishka[asyncpg.Pool]) -> dict[str, bool]:
|
||||
db_ok = await pool.fetchval("SELECT 1") == 1
|
||||
timescale_ok = await pool.fetchval(
|
||||
@@ -30,5 +30,6 @@ async def health(pool: FromDishka[asyncpg.Pool]) -> dict[str, bool]:
|
||||
|
||||
app.include_router(policy.router)
|
||||
app.include_router(folders.router)
|
||||
app.include_router(backfill.router)
|
||||
|
||||
setup_dishka(container, app)
|
||||
|
||||
Reference in New Issue
Block a user