pjfanning commented on code in PR #1919: URL: https://github.com/apache/pekko/pull/1919#discussion_r2192842397
########## persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/Running.scala: ########## @@ -97,30 +97,44 @@ private[pekko] object Running { def currentSequenceNumber: Long } - final case class RunningState[State]( + // This is part of the fix for https://github.com/apache/pekko/issues/1327 and it's necessary to break + // recursion between the `onCommand` and `onMessage` functions in Running[C, E, S]#HandlingCommands. We + // set the flag `inOnCommandCall` to true in `onCommand` before calling functions that will in turn call + // `onMessage`. In `onMessage`, if the flag is set and we would recursively call `onCommand`, we instead + // save the parameters we would use to call `onCommand` and return. When back in `onCommand`, we check if + // `recOnCommandParams` is not empty and, if not, act as if `onMessage` called us directly. In function + // `onCommand` we have a while loop replacing recursive calls so that we don't use all the stack space in + // case a lot of read-only message are stashed + final class UnstashRecurrenceState[State, Command] { Review Comment: seems fine to me -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For additional commands, e-mail: notifications-h...@pekko.apache.org