INNER CODE UNIT · Python
_check_db_connectivity
KatrielMoses/voidaccess · api/main.py:552
def _check_db_connectivity() -> bool:
"""Return True if DB is reachable, False otherwise. Sync wrapper for startup."""
if not os.getenv("DATABASE_URL"):
return False
try:
from db.session import get_session # noqa: PLC0415
from db.queries import db_health_check # noqa: PLC0415
with get_session() as session:
return db_health_check(session)
except Exception as exc:
logger.warning("DB connectivity check failed: %s", exc)
return False
def _check_tor_connectivity() -> bool:
"""Return True if Tor proxy appears to be reachable. Sync wrapper for startup."""
import socket # noqa: PLC0415