Scala FSM actor在一段时间后停止触发状态超时消息

Scala FSM actor在一段时间后停止触发状态超时消息,scala,akka,actor,fsm,Scala,Akka,Actor,Fsm,经典actor文档中的示例FSM遇到了一个问题,一个actor将消息累积在一起,直到达到某个超时 class BatchHandler(implicit inj: Injector) extends FSM[BatchHandler.State, BatchHandler.Data] with Injectable with AppLogging { private val batchTime: FiniteDuration = 10.seconds startWith(Batc

经典actor文档中的示例FSM遇到了一个问题,一个actor将消息累积在一起,直到达到某个超时

class BatchHandler(implicit inj: Injector)
  extends FSM[BatchHandler.State, BatchHandler.Data] with Injectable with AppLogging {

  private val batchTime: FiniteDuration = 10.seconds

  startWith(BatchHandler.Idle, BatchHandler.Uninitialized)

  when(BatchHandler.Idle) {
    case Event(BatchHandler.SetTarget(target), Uninitialized) =>
      stay.using(Todo(target, Vector.empty))
  }

  onTransition {
    case Active -> BatchHandler.Idle =>
      stateData match {
        case Todo(target, queue) =>
          context.actorSelection(target) ! Batch(queue)
        case _                => // nothing to do
      }
  }

  when(Active, stateTimeout = batchTime) {
    case Event(Flush | StateTimeout, t: Todo) =>
      goto(BatchHandler.Idle).using(t.copy(queue = Vector.empty))
  }

  whenUnhandled {
    // common code for both states
    case Event(BatchHandler.Queue(obj), t @ Todo(_, v)) =>
      goto(Active).using(t.copy(queue = v :+ obj))

    case Event(e, s) =>
      stay
  }

  initialize()

}
活动状态的stateTimeout参数工作几分钟,我看到排队的消息被发送到目标。一段时间后,参与者只是保持活动状态,并最终在大约2K条消息时刷新,而不考虑10秒超时


我使用的是akkaVersion=“2.5.23”。我在旧版本中发现了一些问题,比如这个,但现在应该已经解决了。

我想这与邮箱的大小有关。但是这个特性在Akka 2.0中被删除了。这个问题可能会澄清一点