async function processQueue(query, opts = {}) {
  const { isDryRun = false } = opts;
  console.log(`Finding QueueActivity documents for query:${"\n"}${JSON.stringify(query, null, 2)}`);
  const queueActivities = await QueueActivity.find(query);
  if (!queueActivities || !queueActivities.length) {
    console.warn('No QueueActivity documents were found.');
    return;
  }

  console.log(`Starting processQueue() with ${queueActivities.length} QueueActivity documents`);

  if (isDryRun) {
    console.log('This is a dry run!');
  }

  const log = {};
  // eslint-disable-next-line no-restricted-syntax
  for await (const queueActivityDoc of queueActivities) {
    await processQueueActivity(queueActivityDoc, query, isDryRun);
    const { status } = queueActivityDoc;
    log[status] = log[status]
      ? log[status] + 1
      : 1;
  }
  console.log(`${"\n"}End of processQueue() for ${queueActivities.length} activities`);
  console.table(log);
}
/**
 * Process the ingestion queue
 *
 * @param {Object} query Object for find query
 * @param {Bool} opts.isDryRun Default to false
 */
Process the ingestion queue
@param {Object} query Object for find query
@param {Bool} opts.isDryRun Default to false
Process the ingestion queue @param { Object } query Object for find query @param { Bool } opts . isDryRun Default to false
async function processQueue(query, opts = {}) {
  const { isDryRun = false } = opts;
  console.log(`Finding QueueActivity documents for query:${"\n"}${JSON.stringify(query, null, 2)}`);
  const queueActivities = await QueueActivity.find(query);
  if (!queueActivities || !queueActivities.length) {
    console.warn('No QueueActivity documents were found.');
    return;
  }
  console.log(`Starting processQueue() with ${queueActivities.length} QueueActivity documents`);
  if (isDryRun) {
    console.log('This is a dry run!');
  }
  const log = {};
  for await (const queueActivityDoc of queueActivities) {
    await processQueueActivity(queueActivityDoc, query, isDryRun);
    const { status } = queueActivityDoc;
    log[status] = log[status]
      ? log[status] + 1
      : 1;
  }
  console.log(`${"\n"}End of processQueue() for ${queueActivities.length} activities`);
  console.table(log);
}
async function processQueue ( query , opts = { } ) { const { isDryRun = false } = opts ; console . log ( ` ${ "\n" } ${ JSON . stringify ( query , null , 2 ) } ` ) ; const queueActivities = await QueueActivity . find ( query ) ; if ( ! queueActivities || ! queueActivities . length ) { console . warn ( 'No QueueActivity documents were found.' ) ; return ; } console . log ( ` ${ queueActivities . length } ` ) ; if ( isDryRun ) { console . log ( 'This is a dry run!' ) ; } const log = { } ; for await ( const queueActivityDoc of queueActivities ) { await processQueueActivity ( queueActivityDoc , query , isDryRun ) ; const { status } = queueActivityDoc ; log [ status ] = log [ status ] ? log [ status ] + 1 : 1 ; } console . log ( ` ${ "\n" } ${ queueActivities . length } ` ) ; console . table ( log ) ; }
Process the ingestion queue
 @param {Object} query Object for find query
 @param {Bool} opts.isDryRun Default to false
Process the ingestion queue @param { Object } query Object for find query @param { Bool } opts . isDryRun Default to false
// eslint-disable-next-line no-restricted-syntax