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:
co-authored by
Claude Opus 4.6
parent
6b8f5d069b
commit
6798320209
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user