bmc_hub/app/modules/links/jobs/dead_link_check.py

19 lines
597 B
Python
Raw Normal View History

import logging
from app.core.database import execute_query
logger = logging.getLogger(__name__)
async def check_links_health():
rows = execute_query("SELECT id, type, url, host FROM links WHERE deleted_at IS NULL", ()) or []
for row in rows:
execute_query(
"""
INSERT INTO link_status_checks (link_id, status, details)
VALUES (%s, %s, %s::jsonb)
""",
(row["id"], "unknown", '{"reason":"initial implementation placeholder"}'),
)
logger.info("✅ Links health placeholder executed for %s links", len(rows))