def detectPlaySaveSequence()

in src/main/scala/com/spotify/bdrc/pipeline/JoinLogs.scala [35:45]


  def detectPlaySaveSequence(pair: Seq[(String, LogEvent)]): Option[String] = {
    val Seq(first, second) = pair
    if (
      first._1 == "play" && second._1 == "save" && first._2.track == second._2.track &&
      second._2.timestamp - first._2.timestamp <= gapDuration
    ) {
      Some(first._2.track)
    } else {
      None
    }
  }