He-Pin commented on code in PR #3096:
URL: https://github.com/apache/pekko/pull/3096#discussion_r3444077641
##########
persistence/src/main/scala/org/apache/pekko/persistence/fsm/PersistentFSMBase.scala:
##########
@@ -482,11 +481,25 @@ trait PersistentFSMBase[S, D, E] extends Actor with
Listeners with ActorLogging
* transition handling
Review Comment:
🟡 **Suggestion: code duplication with FSM.scala**
The `watchedListeners` field, `addListener`, and `removeListener` are
duplicated nearly identically between `FSM.scala` and
`PersistentFSMBase.scala`. This is understandable given they share the
`Listeners` trait but not a common base beyond that.
Not blocking for this PR — but consider extracting this into a shared mixin
(e.g. `WatchedListeners`) in a follow-up, to avoid divergent fixes if this
logic needs to change later.
Also, `ListenerTerminated` visibility differs: `private` in `FSM` companion
vs `private[persistence]` in `PersistentFSM` companion. This is fine since each
module only accesses its own companion's case class, but worth aligning if the
shared mixin approach is taken.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]