From b71897fa5f8c92bb8193890308830774f8020c5a Mon Sep 17 00:00:00 2001 From: Peppercorn27 Date: Sun, 6 Jul 2025 17:11:42 +0100 Subject: [PATCH] fix web ui latency fix web ui latency in situations where cron shedule has been reduced resulting in more data being present in influxDB than expected --- .../database/scrutiny_repository_device_smart_attributes.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webapp/backend/pkg/database/scrutiny_repository_device_smart_attributes.go b/webapp/backend/pkg/database/scrutiny_repository_device_smart_attributes.go index b1abf6c..96bbad0 100644 --- a/webapp/backend/pkg/database/scrutiny_repository_device_smart_attributes.go +++ b/webapp/backend/pkg/database/scrutiny_repository_device_smart_attributes.go @@ -194,6 +194,9 @@ func (sr *scrutinyRepository) generateSmartAttributesSubquery(wwn string, durati `|> filter(fn: (r) => r["_measurement"] == "smart" )`, fmt.Sprintf(`|> filter(fn: (r) => r["device_wwn"] == "%s" )`, wwn), } + + partialQueryStr = append(partialQueryStr, `|> aggregateWindow(every: 1d, fn: last, createEmpty: false)`) + if selectEntries > 0 { partialQueryStr = append(partialQueryStr, fmt.Sprintf(`|> tail(n: %d, offset: %d)`, selectEntries, selectEntriesOffset)) }