override def handleRequest()

in src/main/scala/com/gu/contentapi/Lambda.scala [21:36]


  override def handleRequest(event: S3Event, context: Context): Unit = {

    val fastlyReportObjects = Await.result(
      Future.sequence(
        event.getRecords.asScala
          .filter(rec => isLogType(Config.FastlyAudioLogsPathName, rec.getS3))
          .map(rec => S3.downloadReport(rec.getS3.getBucket.getName, rec.getS3.getObject.getKey.replaceAll("%3A", ":"))) // looks like the json object is not decoded properly by the SKD
      ).map(_.toList),
      Duration(context.getRemainingTimeInMillis, TimeUnit.MILLISECONDS))

    handleReportsFromFastly(fastlyReportObjects.collect({ case Some(path) => path }))

    logger.debug(s"Cache hits: ${PodcastLookup.cacheHits}")
    logger.debug(s"Cache misses: ${PodcastLookup.cacheMisses}")

  }