When thinking about it again it, I think we need to document properly how timeouts when both stateTimeout and forMax is used, and then make it so. Currently it’s not very well defined.
In your case, when you change stateTimeouts I’d personally not use stateTimeout but always forMax(), which ends up being a lot less confusing I think (otherwise you need to think which one actually will be applied - even if we document it). — konrad On Fri, Apr 3, 2015 at 5:10 PM, Akka Team <[email protected]> wrote: Hi folex, > thanks for reporting. > > Around that time this commit was merged into FSM > https://github.com/akka/akka/commit/2c88bb116903b42decb9d8063dc410325a9b9d29 > which indeed changes semantics of `stay()` slightly (see documentation). > It changed when state transitions are triggered (the events). > > I think there's a different inconsistency uncovered by your example > though... > When using `goto(currentState) forMax Duration.Inf` it was ignored (it > seems, didn't debug yet, just observed), > the same happens with `stay() forMax Duration.Inf`. However `stay() forMax > 10.minutes` did override the 5seconds timeout... > > I think this is a bug and we should investigate in depth - would you mind > opening an issue on http://github.com/akka/akka/issues? > If you'd like to a PR fixing it would be even more awesome! :-) > Thanks a lot in advance! > > -- Konrad > > On Fri, Apr 3, 2015 at 10:38 AM, folex <[email protected]> wrote: > >> sealed trait State >> import scala.concurrent.duration._ >> import akka.actor._ >> >> sealed trait Data >> case object Initial extends State >> case object Waiting extends State >> case object Empty extends Data >> >> class FSMActor extends LoggingFSM[State, Data] { >> startWith(Initial, Empty) >> >> when(Initial) { >> case Event("Wait", _) => goto(Waiting) >> } >> >> when(Waiting, stateTimeout = 5.seconds) { >> case Event("Message", _) => println(self.path.name + " got >> message") >> stay() forMax (Duration.Inf) >> >> case Event(StateTimeout, _) => println(self.path.name + " got >> StateTimeout :("); stay() >> } >> } >> >> val system = ActorSystem("system") >> val fsm = system.actorOf(Props(new FSMActor), "fsm") >> fsm ! "Wait" >> fsm ! "Message" >> >> >> (code on lpaste: http://lpaste.net/130078) >> >> But actor keeps receiving StateTimeout messages >> >> I'm using 2.4-SNAPSHOT, and before Apr 02 update, StateTimeout wasn't >> fired even without `forMax` in stay() clause. >> >> Maybe the problem lays in my understanding of stateTimeout argument? >> Should I use setStateTimeout or something? >> >> Thanks in advance. >> >> -- >> >>>>>>>>>> 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. >> > > > > -- > Akka Team > Typesafe - Reactive apps on the JVM > Blog: letitcrash.com > Twitter: @akkateam > -- Akka Team Typesafe - Reactive apps on the JVM Blog: letitcrash.com Twitter: @akkateam -- >>>>>>>>>> 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.
