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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user