fix: remove dead code duplicates, add SQL LIMIT across all services

- Remove duplicate function definitions with hardcoded "AI-оператор" strings
  (ai_voice_runtime, ai_orchestrator, voice_name_config, voice.py)
- Remove unreachable dead code after return in ai_voice_runtime
- Add SQL LIMIT to 17 unbounded queries across 12 services to prevent OOM
- Move Python-side filtering to SQL WHERE in reporting_service
- Downgrade 19 logger.warning to logger.info for normal-flow events in media_runtime

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Yera All
2026-04-13 12:04:26 +05:00
co-authored by Claude Opus 4.6
parent 6b8f5d069b
commit 6798320209
17 changed files with 70 additions and 302 deletions
+3 -4
View File
@@ -66,14 +66,13 @@ def create_event(payload: AuditEventIn) -> AuditEvent:
def list_events(actor: str | None = None, action: str | None = None, limit: int = 100) -> list[AuditEvent]:
session = get_session()
try:
stmt = select(AuditEventRow).order_by(AuditEventRow.id.asc())
stmt = select(AuditEventRow).order_by(AuditEventRow.id.desc())
if actor:
stmt = stmt.where(AuditEventRow.actor == actor)
if action:
stmt = stmt.where(AuditEventRow.action == action)
rows = session.execute(stmt).scalars().all()
rows = rows[-limit:]
return [_to_out(r) for r in rows]
rows = session.execute(stmt.limit(max(limit, 1))).scalars().all()
return [_to_out(r) for r in reversed(rows)]
finally:
session.close()