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
@@ -244,17 +244,17 @@ def _load_fact_records(
|
||||
queue_id: str | None,
|
||||
channel: str | None,
|
||||
) -> list[dict[str, Any]]:
|
||||
rows = session.execute(
|
||||
select(ReportingInteractionFactRow).order_by(ReportingInteractionFactRow.id.asc())
|
||||
).scalars().all()
|
||||
records = [_serialize_fact_row(row) for row in rows]
|
||||
stmt = select(ReportingInteractionFactRow).order_by(ReportingInteractionFactRow.id.asc())
|
||||
if queue_id:
|
||||
records = [item for item in records if item["queue_id"] == queue_id]
|
||||
stmt = stmt.where(ReportingInteractionFactRow.queue_id == queue_id)
|
||||
if channel:
|
||||
records = [item for item in records if item["channel"] == channel]
|
||||
if dt_from or dt_to:
|
||||
records = [item for item in records if _in_range(item["created_at"], dt_from, dt_to)]
|
||||
return records
|
||||
stmt = stmt.where(ReportingInteractionFactRow.channel == channel)
|
||||
if dt_from:
|
||||
stmt = stmt.where(ReportingInteractionFactRow.created_at >= dt_from.isoformat())
|
||||
if dt_to:
|
||||
stmt = stmt.where(ReportingInteractionFactRow.created_at < dt_to.isoformat())
|
||||
rows = session.execute(stmt).scalars().all()
|
||||
return [_serialize_fact_row(row) for row in rows]
|
||||
|
||||
|
||||
def _load_interactions_map(session, interaction_ids: list[str]) -> dict[str, Interaction]:
|
||||
|
||||
Reference in New Issue
Block a user