Update chunk size for logs table

Co-authored-by: Jared Scheib <jared.scheib@gmail.com>
pull/4225/head
Delmer Reed 2018-08-15 16:44:58 -04:00 committed by Jared Scheib
parent db0ba26f66
commit 3b084e4ed1
1 changed files with 8 additions and 5 deletions

View File

@ -176,7 +176,7 @@ export function buildGeneralLogQuery(
return `${select}${condition}${dimensions}${fillClause}` return `${select}${condition}${dimensions}${fillClause}`
} }
export async function getQueryCountForBounds( export async function getQueryResultsCountForBounds(
lower: string, lower: string,
upper: string, upper: string,
config: QueryConfig, config: QueryConfig,
@ -209,6 +209,9 @@ export async function getQueryCountForBounds(
return getDeep<number>(result, 'results.0.series.0.values.0.1', 0) return getDeep<number>(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( export async function findOlderLowerTimeBounds(
upper: string, upper: string,
config: QueryConfig, config: QueryConfig,
@ -227,7 +230,7 @@ export async function findOlderLowerTimeBounds(
break break
} }
const count = await getQueryCountForBounds( const count = await getQueryResultsCountForBounds(
currentLower.toISOString(), currentLower.toISOString(),
upper, upper,
config, config,
@ -237,7 +240,7 @@ export async function findOlderLowerTimeBounds(
namespace namespace
) )
if (count >= 400) { if (count >= HOW_LOW_CAN_YOU_GO) {
break break
} }
@ -266,7 +269,7 @@ export async function findNewerUpperTimeBounds(
break break
} }
const count = await getQueryCountForBounds( const count = await getQueryResultsCountForBounds(
lower, lower,
currentUpper.toISOString(), currentUpper.toISOString(),
config, config,
@ -276,7 +279,7 @@ export async function findNewerUpperTimeBounds(
namespace namespace
) )
if (count >= 400) { if (count >= HOW_LOW_CAN_YOU_GO) {
break break
} }