From b411d66a2f63fd97dce754097a36d9761806d0b7 Mon Sep 17 00:00:00 2001 From: John Wright Date: Thu, 2 May 2024 21:12:46 +0100 Subject: [PATCH] feat(report): add status check interval --- src/report/runReport.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/report/runReport.ts b/src/report/runReport.ts index 06e41331..a155537b 100644 --- a/src/report/runReport.ts +++ b/src/report/runReport.ts @@ -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 } @@ -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({ @@ -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((resolve) => { https.get(urlResult.rval!, (response) => { resolve(response)