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

close #6295 - set default PoolRouter SupervisorStrategy to Restart #6366

Merged
merged 4 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
31 changes: 16 additions & 15 deletions src/core/Akka.Tests/Routing/RoutingSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Linq;
using Akka.Configuration;
using Akka.Actor;
using Akka.Actor.Dsl;
using Akka.Dispatch;
using Akka.Routing;
using Akka.TestKit;
Expand Down Expand Up @@ -293,27 +294,27 @@ public void Routers_in_general_must_set_supplied_supervisorStrategy_for_FromConf
}

[Fact]
public void Routers_in_general_must_default_to_all_for_one_always_escalate_strategy()
public void Routers_in_general_must_default_to_all_for_one_restart_strategy()
{
var restarter = new OneForOneStrategy(e =>
var props = Props.Create(() => new RestartActor(TestActor));
var routes = new[]
{
TestActor.Tell(e);
return Directive.Restart;
});

var supervisor = Sys.ActorOf(Props.Create(() => new Supervisor(restarter)));
Sys.ActorOf(props, "actor-0"),
Sys.ActorOf(props, "actor-1"),
Sys.ActorOf(props, "actor-2"),
};

supervisor.Tell(new RoundRobinPool(3).Props(Props.Create(() => new RestartActor(TestActor))));
var router = Sys.ActorOf(new RoundRobinGroup(routes.Select(a => a.Path.ToString())).Props());
Copy link
Member Author

Choose a reason for hiding this comment

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

@Arkatufus this needs to be a RoundRobinPool router

var restarted = new HashSet<string>();

var router = ExpectMsg<IActorRef>();
EventFilter.Exception<ArgumentException>("die").ExpectOne(() =>
for (var i = 0; i < 3; i++)
{
router.Tell("die");
});
ExpectMsg<ArgumentException>().Message.Should().Be("die");
ExpectMsg("restarted");
ExpectMsg("restarted");
ExpectMsg("restarted");
ExpectMsg("restarted");
restarted.Add(LastSender.Path.Name);
}

restarted.Should().BeEquivalentTo("actor-0", "actor-1", "actor-2");
}

[Fact]
Expand Down
10 changes: 2 additions & 8 deletions src/core/Akka/Routing/RouterConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,9 @@ public override ActorBase CreateRouterActor()
/// <summary>
/// TBD
/// </summary>
public static SupervisorStrategy DefaultSupervisorStrategy
{
get
{
return new OneForOneStrategy(Decider.From(Directive.Escalate));
}
}
public static SupervisorStrategy DefaultSupervisorStrategy => SupervisorStrategy.DefaultStrategy;



public bool Equals(Pool other)
{
if (ReferenceEquals(null, other)) return false;
Expand Down