Skip to content

Commit

Permalink
feat: shorten async query exponential backoff (#23245)
Browse files Browse the repository at this point in the history
  • Loading branch information
aspicer authored Jun 26, 2024
1 parent 7053c11 commit fdc1b3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/queries/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
isTimeToSeeDataSessionsQuery,
} from './utils'

const QUERY_ASYNC_MAX_INTERVAL_SECONDS = 5
const QUERY_ASYNC_MAX_INTERVAL_SECONDS = 3
const QUERY_ASYNC_TOTAL_POLL_SECONDS = 10 * 60 + 6 // keep in sync with backend-side timeout (currently 10min) + a small buffer

//get export context for a given query
Expand Down Expand Up @@ -87,7 +87,7 @@ export async function pollForResults(

while (performance.now() - pollStart < QUERY_ASYNC_TOTAL_POLL_SECONDS * 1000) {
await delay(currentDelay, methodOptions?.signal)
currentDelay = Math.min(currentDelay * 2, QUERY_ASYNC_MAX_INTERVAL_SECONDS * 1000)
currentDelay = Math.min(currentDelay * 1.25, QUERY_ASYNC_MAX_INTERVAL_SECONDS * 1000)

try {
const statusResponse = (await api.queryStatus.get(queryId, showProgress)).query_status
Expand Down

0 comments on commit fdc1b3f

Please sign in to comment.