private def cancelReindex()

in app/com/gu/floodgate/reindex/ReindexService.scala [87:107]


  private def cancelReindex(
      contentSource: ContentSource
  )(implicit ec: ExecutionContext): Future[Either[CustomError, Happy]] = {
    ws.url(contentSource.reindexEndpoint).delete map { response =>
      response.status match {
        case 200 =>
          val runningJobOrError = runningJobService.getRunningJob(contentSource.id, contentSource.environment)

          runningJobOrError map { runningJob =>
            reindexProgressMonitor ! RemoveTracker(contentSource, runningJob)
            Happy()
          }

        case _ =>
          val error: CustomError =
            CancellingReindexFailed(s"Could not cancel the current reindex for ${contentSource.appName}")
          Left(error)

      }
    }
  }