Skip to content

Commit

Permalink
feat(report): add status check interval
Browse files Browse the repository at this point in the history
  • Loading branch information
johngeorgewright committed May 2, 2024
1 parent 1eae2ca commit b411d66
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/report/runReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Entry, entries } from '../lang/Object'

export interface RunAndDownloadReportOpts {
exportFormat: 'TSV' | 'TSV_EXCEL' | 'CSV_DUMP' | 'XML' | 'XLSX'
statusCheckInterval?: number
query: ReportService.ReportQuery
}

Expand Down Expand Up @@ -70,7 +71,7 @@ export async function runAndDownloadReport(

if (status === 'FAILED') throw new Error(`Report failed.\n\n${rawResponse}`)

await setTimeout(1_000)
await setTimeout(opts.statusCheckInterval || 2_000)
}

const [urlResult] = await client.getReportDownloadURLAsync({
Expand All @@ -80,8 +81,6 @@ export async function runAndDownloadReport(

if (!urlResult.rval) throw new Error('GAM did not provide a download url')

console.info(urlResult.rval)

return new Promise<IncomingMessage>((resolve) => {
https.get(urlResult.rval!, (response) => {
resolve(response)
Expand Down

0 comments on commit b411d66

Please sign in to comment.