protected def latestIncidentKey()

in app/com/gu/contentapi/sanity/support/TestFailureHandlingSupport.scala [42:54]


  protected def latestIncidentKey(): String = {
    incidentKeyDateTime match {
      case Some(keyTimeStamp) if Duration.between(keyTimeStamp, ZonedDateTime.now()).toMinutes < 30 =>
        //re-use key if is less than 30 minutes since previous incident
        val key = keyTimeStamp
        key.toString
      case _ =>
        // generate new key at first and after 30 minutes
        val key = ZonedDateTime.now
        incidentKeyDateTime = Some(key)
        key.toString
    }
  }