From f59b66b7d4de433ed4f29c6c3da4e839387478a0 Mon Sep 17 00:00:00 2001 From: erio Date: Sat, 14 Mar 2026 18:47:37 +0800 Subject: [PATCH] fix(ops): tune aggregation constants to prevent PG overload Increase MAX(bucket_start) query timeout from 3s to 5s to reduce timeout-induced fallbacks. Shrink backfill window from 30 days to 1 hour so that fallback recomputation stays lightweight instead of scanning the entire retention range. --- backend/internal/service/ops_aggregation_service.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/internal/service/ops_aggregation_service.go b/backend/internal/service/ops_aggregation_service.go index ec77fe12..89076ce2 100644 --- a/backend/internal/service/ops_aggregation_service.go +++ b/backend/internal/service/ops_aggregation_service.go @@ -23,7 +23,7 @@ const ( opsAggDailyInterval = 1 * time.Hour // Keep in sync with ops retention target (vNext default 30d). - opsAggBackfillWindow = 30 * 24 * time.Hour + opsAggBackfillWindow = 1 * time.Hour // Recompute overlap to absorb late-arriving rows near boundaries. opsAggHourlyOverlap = 2 * time.Hour @@ -36,7 +36,7 @@ const ( // that may still receive late inserts. opsAggSafeDelay = 5 * time.Minute - opsAggMaxQueryTimeout = 3 * time.Second + opsAggMaxQueryTimeout = 5 * time.Second opsAggHourlyTimeout = 5 * time.Minute opsAggDailyTimeout = 2 * time.Minute