refactor: simplify database logging handler

- Remove retry logic from DatabaseLogHandler (was for SQLite locking)
- Streamline error handling in log emission
- Clean up platform health service

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-13 20:37:34 +01:00
parent 7a7b612519
commit 44832b3fc9
3 changed files with 61 additions and 88 deletions

View File

@@ -305,27 +305,13 @@ class PlatformHealthService:
def _get_database_size(self, db: Session) -> float:
"""Get database size in MB."""
try:
# Try SQLite approach
result = db.execute(
text(
"SELECT page_count * page_size as size "
"FROM pragma_page_count(), pragma_page_size()"
)
)
row = result.fetchone()
if row:
return round(row[0] / (1024 * 1024), 2)
except Exception:
pass
try:
# Try PostgreSQL approach
result = db.execute(text("SELECT pg_database_size(current_database())"))
row = result.fetchone()
if row:
return round(row[0] / (1024 * 1024), 2)
except Exception:
pass
logger.warning("Failed to get database size")
return 0.0
return 0.0