From 3b084e4ed1c05a3b1d95164da138a2700c67a005 Mon Sep 17 00:00:00 2001 From: Delmer Reed Date: Wed, 15 Aug 2018 16:44:58 -0400 Subject: [PATCH] Update chunk size for logs table Co-authored-by: Jared Scheib --- ui/src/logs/utils/index.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ui/src/logs/utils/index.ts b/ui/src/logs/utils/index.ts index a9141b2ce..8665d419f 100644 --- a/ui/src/logs/utils/index.ts +++ b/ui/src/logs/utils/index.ts @@ -176,7 +176,7 @@ export function buildGeneralLogQuery( return `${select}${condition}${dimensions}${fillClause}` } -export async function getQueryCountForBounds( +export async function getQueryResultsCountForBounds( lower: string, upper: string, config: QueryConfig, @@ -209,6 +209,9 @@ export async function getQueryCountForBounds( return getDeep(result, 'results.0.series.0.values.0.1', 0) } +// HOW_LOW_CAN_YOU_GO is the magical cut-off point for number of results where exponential backoff will stop +const HOW_LOW_CAN_YOU_GO = 150 + export async function findOlderLowerTimeBounds( upper: string, config: QueryConfig, @@ -227,7 +230,7 @@ export async function findOlderLowerTimeBounds( break } - const count = await getQueryCountForBounds( + const count = await getQueryResultsCountForBounds( currentLower.toISOString(), upper, config, @@ -237,7 +240,7 @@ export async function findOlderLowerTimeBounds( namespace ) - if (count >= 400) { + if (count >= HOW_LOW_CAN_YOU_GO) { break } @@ -266,7 +269,7 @@ export async function findNewerUpperTimeBounds( break } - const count = await getQueryCountForBounds( + const count = await getQueryResultsCountForBounds( lower, currentUpper.toISOString(), config, @@ -276,7 +279,7 @@ export async function findNewerUpperTimeBounds( namespace ) - if (count >= 400) { + if (count >= HOW_LOW_CAN_YOU_GO) { break }