feat(3.1): /health endpoint (503 при недоступности БД) + db.ping для мониторинга

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
anor
2026-06-10 17:42:29 +10:00
co-authored by Claude Fable 5
parent 52f087aeb0
commit f7995a3b3a
2 changed files with 27 additions and 2 deletions
+6
View File
@@ -70,6 +70,12 @@ def _conn() -> sqlite3.Connection:
return conn
def ping():
"""Лёгкая проверка доступности БД для /health."""
with _conn() as conn:
conn.execute("SELECT 1").fetchone()
def init_db():
with _conn() as conn:
conn.executescript(_CREATE)