fix(api): bound ansible backfill query cost
This commit is contained in:
@@ -648,6 +648,7 @@ async def backfill_missing_auto_repair_execution_receipts_once(
|
||||
stats = {"scanned": 0, "written": 0, "skipped": 0, "error": None}
|
||||
try:
|
||||
async with get_db_context(project_id) as db:
|
||||
await db.execute(text("SET LOCAL statement_timeout = '5000ms'"))
|
||||
result = await db.execute(
|
||||
text("""
|
||||
SELECT
|
||||
@@ -667,7 +668,9 @@ async def backfill_missing_auto_repair_execution_receipts_once(
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM auto_repair_executions existing
|
||||
WHERE existing.executed_steps::text LIKE '%' || apply.op_id::text || '%'
|
||||
WHERE existing.created_at >= NOW() - (:window_hours * INTERVAL '1 hour')
|
||||
AND existing.triggered_by = 'ansible_controlled_apply'
|
||||
AND existing.executed_steps::text LIKE '%' || apply.op_id::text || '%'
|
||||
)
|
||||
ORDER BY apply.created_at DESC
|
||||
LIMIT :limit
|
||||
|
||||
Reference in New Issue
Block a user