From 0b11df5bf0e61f0ea9cd4526ee550cbb1e8fb5b5 Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Thu, 2 Apr 2026 11:23:07 -0400 Subject: [PATCH] Fix Lite long-running query alerts firing on stale DuckDB snapshots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The alert query reads from v_query_snapshots using MAX(collection_time) to find the latest snapshot. When the collector captures 0 active queries, no new rows are inserted, so MAX(collection_time) still returns the old snapshot — causing alerts to re-fire indefinitely on queries that finished hours ago. Add a 10-minute recency check so stale snapshots are ignored. Co-Authored-By: Claude Opus 4.6 (1M context) --- Lite/Services/LocalDataService.WaitStats.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Lite/Services/LocalDataService.WaitStats.cs b/Lite/Services/LocalDataService.WaitStats.cs index 7ebca42..c46e6e9 100644 --- a/Lite/Services/LocalDataService.WaitStats.cs +++ b/Lite/Services/LocalDataService.WaitStats.cs @@ -418,6 +418,7 @@ public async Task> GetLongRunningQueriesAsync( FROM v_query_snapshots AS r WHERE r.server_id = $1 AND r.collection_time = (SELECT MAX(vqs.collection_time) FROM v_query_snapshots AS vqs WHERE vqs.server_id = $1) + AND r.collection_time >= NOW() - INTERVAL '10 MINUTES' AND r.session_id > 50 {spServerDiagnosticsFilter} {waitForFilter}