Skip to content

Commit

Permalink
racy spec fix: `BackoffOnRestartSupervisor_must_respect_maxNrOfRetrie…
Browse files Browse the repository at this point in the history
…s_property_of_OneForOneStrategy` (#5442)

issue was that using `AutoReset` could cause a race where if the scheduler could reset the count in-flight and throw off the estimates used by the tests. Using a `ManualReset` avoids this issue.
  • Loading branch information
Aaronontheweb authored Dec 17, 2021
1 parent 4b37296 commit 60807fe
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public static Props Props(TestLatch latch)
private Props SupervisorProps(IActorRef probeRef)
{
var options = Backoff.OnFailure(TestActor.Props(probeRef), "someChildName", 200.Milliseconds(), 10.Seconds(), 0.0, -1)
.WithManualReset()
.WithSupervisorStrategy(new OneForOneStrategy(4, TimeSpan.FromSeconds(30), ex => ex is StoppingException
? Directive.Stop
: SupervisorStrategy.DefaultStrategy.Decider.Decide(ex)));
Expand Down Expand Up @@ -270,7 +271,7 @@ public void BackoffOnRestartSupervisor_must_respect_maxNrOfRetries_property_of_O
EventFilter.Exception<TestException>().Expect(5, () =>
{
probe.Watch(supervisor);
for (int i = 1; i <= 5; i++)
for (var i = 1; i <= 5; i++)
{
supervisor.Tell("THROW");
if (i < 5)
Expand Down

0 comments on commit 60807fe

Please sign in to comment.