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>
This commit is contained in:
dal 2025-07-11 13:47:31 -07:00 committed by GitHub
parent 75cdd858ab
commit f5b911cd12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -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
};