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
@@ -111,11 +111,10 @@ def create_message(payload: WebchatMessageIn) -> WebchatMessageOut:
def list_messages(session_id: str | None = None, limit: int = 100) -> list[WebchatMessageOut]:
session = get_session()
try:
stmt = select(WebchatMessageRow).order_by(WebchatMessageRow.id.asc())
stmt = select(WebchatMessageRow).order_by(WebchatMessageRow.id.desc())
if session_id:
stmt = stmt.where(WebchatMessageRow.session_id == session_id)
rows = session.execute(stmt).scalars().all()
rows = rows[-limit:]
return [_to_out(row) for row in rows]
rows = session.execute(stmt.limit(max(limit, 1))).scalars().all()
return [_to_out(row) for row in reversed(rows)]
finally:
session.close()