in subscribers/javascript/auto-export-to-s3/lambda/exportToS3.ts [50:64]
async function waitForJobCompletion(jobId: string, dataExchangeClient: DataExchange): Promise<DataExchange.GetJobResponse> {
let job: DataExchange.GetJobResponse;
do {
job = await dataExchangeClient.getJob({ JobId: jobId }).promise();
await sleep(5000);
} while (job.State === 'WAITING' || job.State === 'IN_PROGRESS');
if (job.State === 'ERROR') {
logger.error({ erroredJob: job }, 'Job encountered an error.');
}
return job;
}