mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-06 14:45:36 +01:00
Refactoring healthcheck
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
import os
|
||||
|
||||
import httpx
|
||||
|
||||
|
||||
response = httpx.get(
|
||||
"http://localhost:8080/api/v1/healthcheck",
|
||||
headers={"Authorization": os.environ["API_KEY"]},
|
||||
)
|
||||
response = httpx.get("http://localhost:8080/healthcheck")
|
||||
print(f"HEALTHCHECK STATUS: {response.status_code}")
|
||||
exit(0 if response.status_code == 200 else 1)
|
||||
|
||||
@@ -117,6 +117,11 @@ async def update_cache(request: Request):
|
||||
return "Ok!"
|
||||
|
||||
|
||||
@router.get("/healthcheck")
|
||||
healthcheck_router = APIRouter(
|
||||
tags=["healthcheck"],
|
||||
)
|
||||
|
||||
|
||||
@healthcheck_router.get("/healthcheck")
|
||||
async def healthcheck():
|
||||
return "Ok!"
|
||||
|
||||
@@ -2,7 +2,7 @@ from fastapi import FastAPI
|
||||
|
||||
from prometheus_fastapi_instrumentator import Instrumentator
|
||||
|
||||
from app.views import router
|
||||
from app.views import router, healthcheck_router
|
||||
from core.arq_pool import get_arq_pool
|
||||
from core.db import database
|
||||
|
||||
@@ -13,6 +13,7 @@ def start_app() -> FastAPI:
|
||||
app.state.database = database
|
||||
|
||||
app.include_router(router)
|
||||
app.include_router(healthcheck_router)
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup() -> None:
|
||||
|
||||
Reference in New Issue
Block a user