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

Conversation

Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented May 22, 2024

Changes

Subscriptions to the EventStream need to happen before the actor emitting events starts, otherwise we can end up in a scenario where everything works but the assertion fails.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

Subscriptions to the `EventStream` need to happen _before_ the actor emitting events starts, otherwise we can end up in a scenario where everything works but the assertion fails.
Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

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

Detailed my changes

@@ -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.

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) May 22, 2024 20:59
@Aaronontheweb Aaronontheweb merged commit 3f0be58 into akkadotnet:dev May 22, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant