src/service.js
// async function that will gradually send the facilities to dynamoDB
async function that will gradually send the facilities to dynamoDB
async function that will gradually send the facilities to dynamoDB
async function resumeWriting() {
      const thisBatch = writeRequests.splice(0, BATCH_SIZE);
      if (thisBatch.length === 0) {
        return Promise.resolve();
      }
      await geoTableManager.batchWritePoints(thisBatch).promise();
      requestsSent += thisBatch.length;
      log.info(`Facilities sent to DynamoDB ${requestsSent++}/${TOTAL_FACILITIES}`);
      await new Promise(function(resolve) {
        setInterval(resolve, WAIT_BETWEEN_BATCHES_MS);
      });
      return resumeWriting();
    }
async function resumeWriting ( ) { const thisBatch = writeRequests . splice ( 0 , BATCH_SIZE ) ; if ( thisBatch . length === 0 ) { return Promise . resolve ( ) ; } await geoTableManager . batchWritePoints ( thisBatch ) . promise ( ) ; requestsSent += thisBatch . length ; log . info ( ` ${ requestsSent ++ } ${ TOTAL_FACILITIES } ` ) ; await new Promise ( function ( resolve ) { setInterval ( resolve , WAIT_BETWEEN_BATCHES_MS ) ; } ) ; return resumeWriting ( ) ; }
async function that will gradually send the facilities to dynamoDB
async function that will gradually send the facilities to dynamoDB
// all facilities sent to dynamo // sends the facilities to dynamo // updates the count // sleeps // next batch