feat: expose monitoring pf health detail
This commit is contained in:
@@ -10,6 +10,8 @@ import json
|
||||
import sys
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import text
|
||||
|
||||
from app.db import SessionLocal, init_db
|
||||
from app.models import Project
|
||||
from app.services.monitor import (
|
||||
@@ -131,7 +133,17 @@ def cmd_suggest(payload: dict[str, Any]) -> None:
|
||||
db.close()
|
||||
|
||||
|
||||
def cmd_health(_: dict[str, Any]) -> None:
|
||||
db = SessionLocal()
|
||||
try:
|
||||
db.execute(text("SELECT 1"))
|
||||
_write({"status": "ok"})
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
COMMANDS = {
|
||||
"health": cmd_health,
|
||||
"add-listing": cmd_add_listing,
|
||||
"add-listings": cmd_add_listings,
|
||||
"check-project": cmd_check_project,
|
||||
|
||||
Reference in New Issue
Block a user