<commit_before>package actors.pointInTime

import actors.{CrunchStateActor, GetPortState, GetState}
import akka.persistence.{RecoveryCompleted, _}
import drt.shared.Crunch.MillisSinceEpoch
import drt.shared.FlightsApi.{QueueName, TerminalName}
import drt.shared._
import server.protobuf.messages.CrunchState.CrunchDiffMessage

import scala.collection.immutable._

case object GetCrunchMinutes

class CrunchStateReadActor(pointInTime: SDateLike, queues: Map[TerminalName, Seq[QueueName]]) extends CrunchStateActor("historic", queues) {
  override val receiveRecover: Receive = {
    case SnapshotOffer(metadata, snapshot) =>
      log.info(s"Received SnapshotOffer ${metadata.timestamp} with ${snapshot.getClass}")
      setStateFromSnapshot(snapshot)

    case cdm@ CrunchDiffMessage(createdAtOption, _, _, _, _, _) =>
      createdAtOption match {
        case Some(createdAt) if createdAt <= pointInTime.millisSinceEpoch =>
          log.info(s"Applying crunch diff with createdAt ($createdAt) <= point in time requested: ${pointInTime.millisSinceEpoch}")
          val newState = stateFromDiff(cdm, state)
          state = newState
        case Some(createdAt) =>
          log.info(s"Ignoring crunch diff with createdAt ($createdAt) > point in time requested: ${pointInTime.millisSinceEpoch}")
      }

    case RecoveryCompleted =>
      log.info(s"Recovered successfully")

    case u =><commit_msg>DRT-4774 Unify live crunch state actor persistence ids with read actor<commit_after>package actors.pointInTime

import actors.{CrunchStateActor, GetPortState, GetState}
import akka.persistence.{RecoveryCompleted, _}
import drt.shared.Crunch.MillisSinceEpoch
import drt.shared.FlightsApi.{QueueName, TerminalName}
import drt.shared._
import server.protobuf.messages.CrunchState.CrunchDiffMessage

import scala.collection.immutable._

case object GetCrunchMinutes

class CrunchStateReadActor(pointInTime: SDateLike, queues: Map[TerminalName, Seq[QueueName]]) extends CrunchStateActor("crunch-state", queues) {
  override val receiveRecover: Receive = {
    case SnapshotOffer(metadata, snapshot) =>
      log.info(s"Received SnapshotOffer ${metadata.timestamp} with ${snapshot.getClass}")
      setStateFromSnapshot(snapshot)

    case cdm@ CrunchDiffMessage(createdAtOption, _, _, _, _, _) =>
      createdAtOption match {
        case Some(createdAt) if createdAt <= pointInTime.millisSinceEpoch =>
          log.info(s"Applying crunch diff with createdAt ($createdAt) <= point in time requested: ${pointInTime.millisSinceEpoch}")
          val newState = stateFromDiff(cdm, state)
          state = newState
        case Some(createdAt) =>
          log.info(s"Ignoring crunch diff with createdAt ($createdAt) > point in time requested: ${pointInTime.millisSinceEpoch}")
      }

    case RecoveryCompleted =>
      log.info(s"Recovered successfully")

    case u =>
{'fraction_non_alphanumeric': 0.09606682909850331, 'fraction_numerical': 0.0013922728854855553, 'mean_word_length': 4.60233918128655, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '375545', 'n_tokens_mistral': 844, 'n_tokens_neox': 842, 'n_words': 190}