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

2.7.x fix context stop #164

Merged
merged 1 commit into from
May 11, 2022
Merged

Conversation

wsargent
Copy link
Member

@wsargent wsargent commented May 8, 2022

@wsargent wsargent changed the base branch from 2.8.x to 2.7.x May 8, 2022 02:23
@@ -80,7 +82,7 @@ public UserActor(@Assisted String id,
//.log("actorWebsocketFlow", logger)
.watchTermination((n, stage) -> {
// When the flow shuts down, make sure this actor also stops.
stage.thenAccept(f -> context().stop(self()));
Patterns.pipe(stage, getContext().dispatcher()).to(self());
Copy link
Member Author

Choose a reason for hiding this comment

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

pipe Done to self

@@ -99,6 +101,8 @@ public Receive createReceive() {
.match(UnwatchStocks.class, unwatchStocks -> {
logger.info("Received message {}", unwatchStocks);
unwatchStocks(unwatchStocks.symbols);
}).match(Done.class, done -> {
context().stop(self());
Copy link
Member Author

Choose a reason for hiding this comment

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

call context.stop inside receive block where it's safe

@@ -62,6 +63,9 @@ class UserActor @Inject()(@Assisted id: String, @Named("stocksActor") stocksActo

case UnwatchStocks(symbols) =>
unwatchStocks(symbols)

case Done =>
context.stop(self)
Copy link
Member Author

Choose a reason for hiding this comment

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

Call context.stop from receive block

@@ -75,7 +79,7 @@ class UserActor @Inject()(@Assisted id: String, @Named("stocksActor") stocksActo
// from the browse), using a coupled sink and source.
Flow.fromSinkAndSourceCoupled(jsonSink, hubSource).watchTermination() { (_, termination) =>
// When the flow shuts down, make sure this actor also stops.
termination.foreach(_ => context.stop(self))
termination.pipeTo(self)
Copy link
Member Author

Choose a reason for hiding this comment

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

pipe Done to self

Copy link

@johanandren johanandren left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @wsargent

@mkurz
Copy link
Member

mkurz commented May 10, 2022

Thanks as well, I will activate GitHub actions for this repo tonight, so we can run tests for it.

@mkurz
Copy link
Member

mkurz commented May 11, 2022

Closing / Re-opening to trigger that newly added GHA checks

@mkurz mkurz closed this May 11, 2022
@mkurz mkurz reopened this May 11, 2022
@mkurz
Copy link
Member

mkurz commented May 11, 2022

Ahh this PR is against the 2.7.x branch! I should have looked closer.
Seems like we don't need this fix for the 2.8.x branch anyway.

@mkurz mkurz merged commit 4a6e695 into playframework:2.7.x May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants