def updateFor()

in app/controllers/Api.scala [66:99]


  def updateFor(repoId: RepoId, acceptList: RepoAcceptList): Future[Result] = {
    val scanGuardF = Future { // wrapped in a future to avoid timing attacks
      val knownRepo = acceptList.allKnownRepos(repoId)
      logger.info(s"$repoId known=$knownRepo")
      require(knownRepo, s"${repoId.fullName} not on known-repo whitelist")

      val scanScheduler = repoScanSchedulerCache.get(repoId)
      logger.debug(s"$repoId scanScheduler=$scanScheduler")

      val firstScanF = scanScheduler.scan()

      firstScanF.onComplete { _ => delayer.delayTheFuture {
        /* Do a *second* scan shortly after the first one ends, to cope with:
         * 1. Latency in GH API
         * 2. Checkpoint site stabilising on the new version after deploy
         */
          scanScheduler.scan()
        }
      }

      firstScanF
    }
    val mightBePrivate = !acceptList.publicRepos(repoId)
    if (mightBePrivate) {
      // Response must be immediate, with no private information (e.g. even acknowledging that repo exists)
      Future.successful(NoContent)
    } else {
      // we can delay the response to return information about the repo config, and the updates generated
      for {
        scanGuard <- scanGuardF
        scan <- scanGuard
      } yield Ok(JsArray(scan.map(summary => JsNumber(summary.prCheckpointDetails.pr.number))))
    }
  }