Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix race conditions with ReceivePersistentActorTests #7194

Merged
merged 1 commit into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public void Given_persistent_actor_with_no_receive_command_specified_When_receiv
//Given
var pid = "p-1";
WriteEvents(pid, 1, 2, 3);
var actor = Sys.ActorOf(Props.Create(() => new NoCommandActor(pid)), "no-receive-specified");
Sys.EventStream.Subscribe(TestActor, typeof(UnhandledMessage));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to subscribe to the EventStream first, so we don't end up with a race condition behind the scenes.


var actor = Sys.ActorOf(Props.Create(() => new NoCommandActor(pid)), "no-receive-specified");

//When
actor.Tell("Something");

Expand All @@ -50,8 +50,8 @@ public void Given_persistent_actor_with_no_receive_event_specified_When_receivin
WriteEvents(pid, "Something");

// when
var actor = Sys.ActorOf(Props.Create(() => new NoEventActor(pid)), "no-receive-specified");
Sys.EventStream.Subscribe(TestActor, typeof(UnhandledMessage));
var actor = Sys.ActorOf(Props.Create(() => new NoEventActor(pid)), "no-receive-specified");

//Then
ExpectMsg<UnhandledMessage>(m => ((string)m.Message) == "Something" && Equals(m.Recipient, actor));
Expand Down