Skip to content

Commit

Permalink
fix: message ordering guarantee
Browse files Browse the repository at this point in the history
  • Loading branch information
Roiocam committed Sep 25, 2023
1 parent e6f3fd8 commit 69fdf3e
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,13 @@ class SupervisionSpec extends ScalaTestWithActorTestKit("""
}

override def onMessage(message: Command): Behavior[Command] = {
monitor ! Pong(0)
Behaviors.same
message match {
case Ping(i) =>
monitor ! Pong(i)
Behaviors.same
// ignore others.
case _ => Behaviors.same
}
}
}

Expand All @@ -330,8 +335,8 @@ class SupervisionSpec extends ScalaTestWithActorTestKit("""
probe.expectMessage(ReceivedSignal(PostStop))
probe.expectMessage(Started)
// expect no message lost
probe.expectMessage(Pong(0))
probe.expectMessage(Pong(0))
probe.expectMessage(Pong(1))
probe.expectMessage(Pong(2))
}
}

Expand Down

0 comments on commit 69fdf3e

Please sign in to comment.