From f5b911cd12d6c0eb77db1b3c1a97fa77f6ecaf74 Mon Sep 17 00:00:00 2001 From: dal Date: Fri, 11 Jul 2025 13:47:31 -0700 Subject: [PATCH] Update apps/api/libs/handlers/src/metrics/get_metric_data_handler.rs Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- .../libs/handlers/src/metrics/get_metric_data_handler.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/api/libs/handlers/src/metrics/get_metric_data_handler.rs b/apps/api/libs/handlers/src/metrics/get_metric_data_handler.rs index ba90245a5..8b6a358c9 100644 --- a/apps/api/libs/handlers/src/metrics/get_metric_data_handler.rs +++ b/apps/api/libs/handlers/src/metrics/get_metric_data_handler.rs @@ -204,9 +204,10 @@ pub async fn get_metric_data_handler( let has_more_records = query_result.data.len() > 5000; // Truncate to 5000 records if we got more - let data = if has_more_records { - query_result.data.into_iter().take(5000).collect() - } else { + let mut data = query_result.data; + if has_more_records { + data.truncate(5000); + } query_result.data };