Hi Kevin! You are right in that overriding a timeout with an infinite one is not possible (I’d call it a design restriction of the current API), but just passing 100.days should be a reasonable workaround (Int.MaxValue.nanos will not work since the system’s scheduler is limited to 2^31 * akka.scheduler.tick-duration).
Concerning the behavior of forMax: it is a one-time override for this particular state change, modifying the stateTimeouts map would violate the integrity of the declarative DSL. One mistake we have not yet corrected, though, is that StateTimeout is a bit of a misnomer—more accurate would be StateBasedReceiveTimeout. Unfortunately changing this is basically impossible without way too much gratuitous breakage. Regards, Roland > 7 apr 2015 kl. 17:08 skrev Kevin Meredith <[email protected]>: > > I replaced `Duration.Inf` with `1.minute`: > > # begins in the Initial state > > scala> fsm ! "Message" > currentState.stateName: Initial > nextState.notifies: true > currentState.timeout: None > stateTimeouts(currentState.stateName): Some(5 seconds) > > # Now it's in the Waiting state > > fsm got message > currentState.stateName: Waiting > nextState.notifies: false > currentState.timeout: Some(1 minute) > stateTimeouts(currentState.stateName): Some(5 seconds) > > # but, then the timeout is set to None somewhere > > scala> fsm got StateTimeout :( > currentState.stateName: Waiting > nextState.notifies: false > currentState.timeout: None > stateTimeouts(currentState.stateName): Some(5 seconds) > fsm got StateTimeout :( > > # and it resumes with the 5 seconds > > currentState.stateName: Waiting > nextState.notifies: false > currentState.timeout: None > stateTimeouts(currentState.stateName): Some(5 seconds) > > Would it be worthwhile for `forMax` to update the mutable stateTimeouts map? > > So, the new `forMax` would look like: > > def forMax(timeout: Duration): State[S, D] = timeout match { > case f: FiniteDuration ⇒ copy(timeout = Some(f)); > stateTimeouts(currentState.stateName) = f > case _ ⇒ copy(timeout = None); > stateTimeouts.remove(currentState.stateName) > } > > Does that make sense? > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/> > >>>>>>>>>> Check the FAQ: > >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html > >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html> > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > >>>>>>>>>> <https://groups.google.com/group/akka-user> > --- > You received this message because you are subscribed to the Google Groups > "Akka User List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/akka-user > <http://groups.google.com/group/akka-user>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. Dr. Roland Kuhn Akka Tech Lead Typesafe <http://typesafe.com/> – Reactive apps on the JVM. twitter: @rolandkuhn <http://twitter.com/#!/rolandkuhn> -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
