Forgot properly invoking the exception
All checks were successful
Build & Publish to GHCR / build (push) Successful in 38s
All checks were successful
Build & Publish to GHCR / build (push) Successful in 38s
This commit is contained in:
parent
51771fb378
commit
8d2020818d
@ -67,13 +67,13 @@ async def prometheus_middleware(request: Request, call_next):
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
@api.get("/health", tags=["Health"])
|
@api.get("/health", tags=["Health"])
|
||||||
async def return_health(db=Depends(get_db)):
|
def return_health(db=Depends(get_db)):
|
||||||
try:
|
try:
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute("SELECT 1")
|
cursor.execute("SELECT 1")
|
||||||
cursor.fetchone()
|
cursor.fetchone()
|
||||||
db_status = "ok"
|
db_status = "ok"
|
||||||
except Exception:
|
except Exception as e:
|
||||||
logger.error(f"Health check DB failed: {e}")
|
logger.error(f"Health check DB failed: {e}")
|
||||||
db_status = "error"
|
db_status = "error"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user